RSelenium::rsDriver() not working as expected.

I'm trying to start a server and browser using the below code but I get this error.
I looked over the internet and couldn't find anything which could help me out.

rD <- RSelenium::rsDriver(
      port = 4444L,
      browser = c("firefox"),
      version = "latest",
      ...
    )
remDr <- rD[['client']]
remDr$open(silent = TRUE)

Error:

checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"
Could not open firefox browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused
Check server log for further details.
Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused
In addition: Warning message:
In RSelenium::rsDriver(port = 4444L, browser = c("firefox"), version = "latest",  :
 
 Error in checkError(res) : 
  Undefined error in httr call. httr output: Failed to connect to localhost port 4444: Connection refused 
> 

If I execute your code

rD <- RSelenium::rsDriver(
    port = 4444L,
    browser = c("firefox"),
    version = "latest",
    ...
)

I get

Error: '...' used in an incorrect context

which suggest that your displayed code does not match your displayed output.

Please see FAQ: How to do a minimal reproducible example ( reprex ) for beginners for how to avoid this.

When I removed the , ... part it worked for me on Windows10 after I gave Windows Defender permission to do the connect.

Hii @HanOostdijk,
Thank you so much for replying. I'm using Ubuntu 18.04 and it didn't throw any error like that.
I literally just found the thing which was causing the issue.
RSelenium's rsDriver uses wdman::selenium() to start the server.
This was the output:

> wdman::selenium()
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
Creating directory: /home/lazycipher/.local/share/binman_seleniumserver/generic/3.141.59
Downloading binary: https://www.googleapis.com/download/storage/v1/b/selenium-release/o/3.141%2Fselenium-server-standalone-3.141.59.jar?generation=1542184006...

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.

wdman::selenium()
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
Creating directory: /home/lazycipher/.local/share/binman_seleniumserver/generic/4.0.0-alpha-1
Downloading binary: https://www.googleapis.com/download/storage/v1/b/selenium-release/o/4.0%2Fselenium-server-standalone-4.0.0-alpha-1.jar?generation=1556122...

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.

> wdman::selenium()
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
Creating directory: /home/lazycipher/.local/share/binman_seleniumserver/generic/4.0.0-alpha-2
Downloading binary: https://www.googleapis.com/download/storage/v1/b/selenium-release/o/4.0%2Fselenium-server-standalone-4.0.0-alpha-2.jar?generation=1562016...

Error in curl::curl_fetch_disk(url, x$path, handle = handle) : 
  Unrecognized content encoding type. libcurl understands deflate, gzip content encodings.

sel <- wdman::selenium()
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
>

I tried running the same thing twice more and got the same outputs but with a small difference. It was the version of selenium which was different each time.
The 4th time I ran the same command to start the server and no download process shows up. Then I checked the log and found that the jar was corrupted.

 sel$log()
$stderr
[1] "Error: Invalid or corrupt jarfile /home/lazycipher/.local/share/binman_seleniumserver/generic/4.0.0-alpha-2/selenium-server-standalone-4.0.0-alpha-2.jar"

$stdout
character(0)

> 

Now, I downloaded the jar from the official website and placed inside that directory and it worked perfectly. One more thing was that I specified a version to use in order to avoid alpha releases.

It worked but still I couldn't understand why it's happening!

But that is only a problem when it sometimes is working and the other moment not.
I assume it will work for you from now on. Have a nice day!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.