2

Seeking guidance on how to resolve the subject line error.

The many previous posts and solutions referenced here have already been reviewed/tried.

In the past this same error has been resolved by updating R, Rselenium, Selenium Server (selenium-server-4.1.3.jar), Java, Chrome browser, Chromedriver and/or Gecko Driver (when using Firefox). All were updated to the latest versions. Also tried Firefox. Error remains.

Windows 10 was updated/computer rebooted. No joy.

The code, which has worked for years and as recently as two weeks ago:

  remDr <- remoteDriver(browserName = "chrome")
  remDr$open(silent = TRUE)  

Error message and parameters:

Error in checkError(res) : 
Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused 
remDr
$remoteServerAddr
[1] "localhost"

$port
[1] 4444

$browserName
[1] "chrome"

$version
[1] ""

$platform
[1] "ANY"

$javascript
[1] TRUE

$nativeEvents
[1] TRUE

$extraCapabilities
list()

What else should I examine or try?

LWRMS
  • 547
  • 8
  • 18
  • Try using firefox `driver = rsDriver( port = 4879L, browser = c("firefox"))` and mention version number for chrome `driver <- rsDriver(browser = "chrome",port = 9635L, chromever = "99.0.4844.17")` – Nad Pat Apr 18 '22 at 04:39
  • I tried both suggestions and connection still refused. chromever is 100.0.4896.127. It is (Official Build) (64-bit) – LWRMS Apr 18 '22 at 15:56
  • Similar question https://stackoverflow.com/questions/45395849/cant-execute-rsdriver-connection-refused – Nad Pat Apr 18 '22 at 16:27

1 Answers1

1

The solution was to revert back to selenium-server-standalone-3.9.1.jar.

For folks trying to set this up for the first time, the steps that work for me are to run a batch file (.cmd) with the following two lines before running the R file.

java -jar selenium-server-standalone-3.9.1.jar
pause

Of course, edit the first line to match the file name as new selenium server versions release. Place the .jar file and browser drivers in a folder that's in the system search path (I edit the system path to include a custom folder that's dedicated to RSelenium related files).

When the command box pops up, you should see the following line:

07:35:53.054 INFO - Selenium Server is up and running on port 4444

My big mistake was not to double check for that line, once I returned to this with fresh eyes I realized that I should look for that line, then the solution was obvious.

Then these RSelenium commands work:

remDr <- remoteDriver(browserName = "chrome")
remDr$open(silent = TRUE)  
LWRMS
  • 547
  • 8
  • 18