memokerobi
memokerobi

Reputation: 143

Rselenium connection times out before connecting to server after updating Chrome

I have used RSelenium to scrape webpages without any issue for over a year including updating Chrome regularly. Today I updated Chrome to its latest version (89.0.4389.82). After the update, RSelenium can't connect to the server and times out. Here is the error message:

Selenium message:Timed out waiting for driver server to start.
System info: host: 'xxxx', ip: xxx, os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.5', java.version: '1.8.0_60'
Driver info: driver.version: unknown
Could not open chrome browser.

I also don't know why it says driver version unknown. I followed the guides on other simular questions and updated chromedriver to version 89.0.4389.23.

Here is the code that used to work before updating chrome:

driver <- rsDriver(browser=c("chrome"), chromever="87.0.4280.88", port = 4568)

Here is what I'm working with now which results in an error:

driver <- rsDriver(browser=c("chrome"), chromever="89.0.4389.23", port = as.integer(4568))

Upvotes: 1

Views: 320

Answers (1)

memokerobi
memokerobi

Reputation: 143

I was able to fix this thanks to this info I found. You can visit the link for more detailed information.

rsDriver has a boolean argument check that is TRUE by default. Its official description:

If TRUE check the versions of selenium available and the versions of associated drivers (chromever, geckover, phantomver, iedrver). If new versions are available they will be downloaded.

This downloads both chromedriver_mac64.zip and chromedriver_mac64_m1.zip. The chromedriver installed from the m1 file on Macs. What I did to fix the problem was go to

~/Library/Application Support/binman_chromedriver/mac64/89.0.4389.23

and then delete the m1 file and chromedriver. Then unzip chromedriver_mac64.zip to get the correct chromedriver. Go back to R and run rsDriver with the argument check set to false:

driver <- rsDriver(browser=c("chrome"), chromever="87.0.4280.88", port = 4568, check = FALSE)

This made it work for me

Upvotes: 1

Related Questions