1

I'm running R version 3.6.2 on Windows 10. I will preface this post by pointing out that I am still a beginner with R & programming in general and any help or kindness would be greatly appreciated :)

For my current project, I am using RSelenium (and Docker) to programmatically extract a tract and county code for a given address from the FFIEC Geocoding website: https://geomap.ffiec.gov/FFIECGeocMap/GeocodeMap1.aspx

Code

Before running the following code, I run Docker Desktop. Then:

shell('docker run -d -p 4445:4444 selenium/standalone-chrome')


library(RSelenium)


remDr <- remoteDriver(remoteServerAddr = "localhost",
                      port = 4445L,
                      browserName = "chrome")

remDr$open()
remDr$navigate("https://geomap.ffiec.gov/FFIECGeocMap/GeocodeMap1.aspx")

## Input Address Info & Click Button
address_element <- remDr$findElement(using = 'css selector', value = "#Address")
address_element$sendKeysToElement(list("800 W Olympic Blvd, Los Angeles, CA 90015"))

button_element <- remDr$findElement(using = 'css selector', value = '#btnSearch')
button_element$clickElement()

Up until here I get no errors. However, no matter what I run after button_element$clickElement() -- whether it's remDr$screenshot(display = TRUE) or run the rest of the code:

tract.out <- remDr$findElement(using = 'css selector', value = "#TractCode")
tract.code <- tract.out$getElementText()
county.out <- remDr$findElement(using = 'css selector', value = "#CountyCode")  
county.code <- county.out$getElementText()

remDr$close()

I get the following error (the error pops up right after tract.out, which makes me think the page is crashing after button_element$clickElement):

"Selenium message:unknown error: session deleted because of page crash
from tab crashed
  (Session info: chrome=80.0.3987.149)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'be3eb420581f', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '4.19.76-linuxkit', java.version: '1.8.0_242'
Driver info: driver.version: unknown

Error:   Summary: UnknownError
     Detail: An unknown server-side error occurred while processing the command.
     class: org.openqa.selenium.WebDriverException
     Further Details: run errorDetails method"

Does anyone have an idea as to what may be causing this? I have played around with different levels of the address search bar and button elements, CSS Selectors & XPaths. Is there something blatant that I am missing?

Any guidance or additional resources would be greatly appreciated!!

Nad Pat
  • 3,129
  • 3
  • 10
  • 20
daolive
  • 21
  • 2

1 Answers1

1

So after a little more digging, I figured out a quick fix. Apparently when starting the docker container, use the 'dev/shm' volume (see code chunk below).

For additional reading, consult: https://github.com/SeleniumHQ/docker-selenium/issues/589 https://github.com/SeleniumHQ/docker-selenium#running-the-images

Here is the fix:

shell('docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:3.141.59-20200326')

library(RSelenium)

remDr <- remoteDriver(remoteServerAddr = "localhost",
                      port = 4444L,
                      browserName = "chrome")

That's it! With those small changes the rest of the code runs great.

daolive
  • 21
  • 2
  • Hi, I have the same problem. I was taking the steps in this answer when I start docker https://stackoverflow.com/a/65192591/7928283 and I don't know if I have to keep those steps or just open docker and run you solution. Hope that you can help me. – Ernesto Riveros Barrientos Aug 10 '21 at 21:18