0

I have the code:

    startServer(args = c("-port 4456"), log = FALSE, invisible = FALSE)
    selServ <- startServer(args = c("-port 4456", "-Dwebdriver.chrome.driver=C:/Drivers/chromedriver"), log = TRUE) 
    remDr <- remoteDriver(browserName="chrome", port=4456)
    remDr$open()

I have the latest Chrome driver in C:\Drivers\chromedriver.exe. When I run the code, the server starts but I get the unhappy Chrome face and error MY exact issue The same driver works with my Python and C# scripts but they are using WebDriver. Does anyone know what could be causing this error or how to use WebDriver with R?

done_merson
  • 2,800
  • 2
  • 22
  • 30
  • In your code you have started two Selenium Servers. Your first line of code starts a Selenium Server without reference to the location of chrome driver. – jdharrison Oct 27 '16 at 09:40

1 Answers1

0

You start two Selenium Servers with your code. The call to chrome driver is an argument for the JVM and should be passed as an argument in javaargs. The chromedriver is also chromedriver.exe in windows so this may cause an issue

library(RSelenium)
selServ <- startServer(args = c("-port 4456"), javaargs = c("-Dwebdriver.chrome.driver=C:/Users/john/Documents/chromedriver.exe"), 
                       invisible = FALSE) 
remDr <- remoteDriver(browserName="chrome", port=4456)
remDr$open()

The functions startServer and checkForServer are deprecated. I would recommend using a Docker container to run a SeleniumServer/chromedriver.

docker run -d -p 5901:5900 -p 127.0.0.1:4456:4444 selenium/standalone-chrome-debug:2.53.1

then you can run as before

remDr <- remoteDriver(browserName="chrome", port=4456)
remDr$open()

See http://rpubs.com/johndharrison/RSelenium-Docker for more details.

jdharrison
  • 30,085
  • 4
  • 77
  • 89