1

I am trying (for the first time) to scrape content from a dynamic webpage, for which RSelenium appears to be the go-to. I cannot however get past the first step of calling rsDriver.

My code:

rdriver <- rsDriver(browser = "chrome",
                    port = free_port(),
                    chromever  = "109.0.5414.25")

The rsDriver() function started throwing an error every time I tried to open it

[1] "Connecting to remote server" Could not open chrome browser. Client error message: Undefined error in httr call. httr output: Failed to connect to localhost port 14415: Connection refused Check server log for further details. Warning message: In rsDriver(browser = "chrome", port = free_port(), chromever = "109.0.5414.25") : Could not determine server status.`

Version:

R 4.2.2

Java(TM) SE Development Kit 19.0.2 (64 bit)

> binman::list_versions("chromedriver")
$win32
[1] "109.0.5414.25" "109.0.5414.74" "110.0.5481.30"

> binman::list_versions("seleniumserver")
$generic
[1] "3.141.59"      "4.0.0-alpha-1" "4.0.0-alpha-2"`

Any recommendations are much appreciated.

I installed all the necessary programs from scratch. I searched for help on the internet and couldn't find a solution

Marco Sandri
  • 23,289
  • 7
  • 54
  • 58
Maciej
  • 11
  • 1
  • Does this answer your question? [can't execute rsDriver (connection refused)](https://stackoverflow.com/questions/45395849/cant-execute-rsdriver-connection-refused) – Ric Jan 26 '23 at 19:09

1 Answers1

0

there is an outstanding issue with how the wdman package reads the latest versions of Chrome. This is causing issues for lots of users (examples here https://stackoverflow.com/a/75176907/15363011 and here https://github.com/ropensci/RSelenium/issues/264)

You can specify a version of Chrome before the issue took place and binman/wdman will download and start using it:

    rdriver <- rsDriver(browser = "chrome",
                    port = free_port(),
                    chromever  = "108.0.5359.71")

If you'd like to use the newest versions, the fix is to delete the LICENSE.chromedriver file found in the same directory as the driver. You can find out how to do that in the other issues that I linked. If you want to use the latest version of Chrome you will have to do this any time a new chrome driver is released.

  • I downloaded and installed the version chromever = "108.0.5359.71" `rdriver <- rsDriver(browser = "chrome", port = free_port(), chromever = "108.0.5359.71")` Now it is throwing me an error `Could not open chrome browser. Client error message: Undefined error in httr call. httr output: Failed to connect to localhost port 14415: Connection refused Check server log for further details. Komunikat ostrzegawczy: W poleceniu 'rsDriver(browser = "chrome", port = free_port(), chromever = "108.0.5359.71")': Could not determine server status.` – Maciej Jan 28 '23 at 10:41
  • I am sorry to hear that did not work, can you run `library(wdman)` `selenium(chromever = "108.0.5359.71", retcommand = T)` and send the results? – bingbongtelecom Jan 28 '23 at 19:58
  • "C:\\PROGRA~1\\COMMON~1\\Oracle\\Java\\javapath\\java.exe -Dwebdriver.chrome.driver=\"C:\\Users\\MSI\\AppData\\Local\\binman\\binman_chromedriver\\win32\\108.0.5359.71/chromedriver.exe\" -Dwebdriver.gecko.driver=\"C:\\Users\\MSI\\AppData\\Local\\binman\\binman_geckodriver\\win64\\0.32.1/geckodriver.exe\" -Dphantomjs.binary.path=\"C:\\Users\\MSI\\AppData\\Local\\binman\\binman_phantomjs\\windows\\2.1.1/phantomjs-2.1.1-windows/bin/phantomjs.exe\" -jar \"C:\\Users\\MSI\\AppData\\Local\\binman\\binman_seleniumserver\\generic\\4.0.0-alpha-2/selenium-server-standalone-4.0.0-alpha-2.jar\" -port 4567" – Maciej Feb 03 '23 at 09:35
  • I send the result of the query above. Thanks – Maciej Feb 03 '23 at 09:36
  • Thank you I cannot see the problem within that step, so if it's ok could you please send more logs? use the instructions here to send that command into your terminal and send back the output. Thank you https://stackoverflow.com/a/42468957/15363011 – bingbongtelecom Feb 03 '23 at 23:40