Search code examples
rselenium-webdriverserverconnectionrselenium

How to connect to a Selenium server through RSelenium?


I'm trying to learn how to use the RSelenium package, but I haven't even been able to connect to a server yet. My code is as simple as:

library(RSelenium)
rs_driver <- rsDriver()
rs_driver

The error message I get is:

[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 4567: Connection refused
Check server log for further details.
$client
[1] "No sessionInfo. Client browser is mostly likely not opened."

$server
PROCESS 'file413018516402.bat', finished.
Warning message:
In rsDriver() : Could not determine server status.

I already tried:

  1. Updating Java, Chrome, RStudio, and both netstat and RSelenium.
  2. Several different specifications for rsDriver() arguments, varying:
    • The browser. For Chrome, I also tried different versions, varying chromever.
    • Setting port manually, or by using free_port() from netstat.
  3. Turning off the Windows Defender Firewall for RStudio (though I'm not completely sure if that's necessary and if I did this properly).

Despite having come across some related questions (as listed below), either they remain unsolved or the suggested solutions weren't successfully implemented by me.

I'd really appreciate any help :)


Solution

  • Deleting "LICENSE.chromedriver" (Ric Villalba's suggestion) solved my problem.