ropensci / RSelenium

An R client for Selenium Remote WebDriver

Home Page:https://docs.ropensci.org/RSelenium

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rsDriver not launching Chrome under mac64

JeffreyBLewis opened this issue · comments

Operating System

mac64

Selenium Server version (selenium-server-standalone-3.0.1.jar etc.)

4.0.0-alpha-2

Browser version (firefox 50.1.0, chrome 54.0.2840.100 (64-bit) etc.)

Chrome 88.0.4324.87

Other driver version (chromedriver 2.27, geckodriver v0.11.1, iedriver x64_3.0.0, PhantomJS 2.1.1 etc.)

chromedriver 88.0.4324.27

Expected behaviour

Expect

rD <- rsDriver(browser=c("chrome"), verbose=TRUE, check=TRUE)

to launch chrome and create a working selenium connection.

Actual behaviour

rD <- rsDriver(browser=c("chrome"), verbose=TRUE, check=TRUE)

results in

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"

Selenium message:Timed out waiting for driver server to start.
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: '', ip: '', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.7', java.version: '1.8.0_201'
Driver info: driver.version: unknown

Could not open chrome browser.
Client error message:
	 Summary: UnknownError
 	 Detail: An unknown server-side error occurred while processing the command.
	 Further Details: run errorDetails method
Check server log for further details.

The reason and I what think can be done to work around is shown at ropensci/wdman#25

Steps to reproduce the behaviour

rD <- rsDriver(browser=c("chrome"), verbose=TRUE, check=TRUE)

on an intel-based mac64 computer.

Solution (temporary)

(I have tested this is windows and hopefully it will be solved in your system too. )

rd <- list()

rd$server <- wdman::selenium(
  port = 4567L,
  chromever = NULL, geckover = NULL, iedrver = NULL, phantomver = NULL,
  check = TRUE,
  jvmargs =list(
    chrome = paste0(
      "-Dwebdriver.chrome.driver=",
      paste0(
        '"',
        normalizePath(
          # here you may need to choose which version to work with
          # I am assuming you have latest chromedriver and chrome
          # otherwise you may need to store the output into a variable and
          # choose from there (the output of list.files)
          max(
            list.files(
              binman::app_dir("chromedriver"), 
              recursive = TRUE, 
              pattern = "[^\\.]chromedriver$|chromedriver\\.", 
              full.names = TRUE)
          )
        ),
        '"')
    )
  )
)


rd$client <- RSelenium::remoteDriver(
  port = 4567L, 
  browser = "chrome"
)

rd$client$open()

Details:

This will not run (as of now)
RSelenium::rsDriver(browser=c("chrome"), verbose=TRUE, check=FALSE)
Because of an additional file that is currently coming with Chrome Driver :
LICENSE.chromedriver
Check it
list.files(binman::app_dir("chromedriver"), recursive = TRUE)
You can check how the command is getting messed up
wdman::selenium(port = 4567L, retcommand = TRUE, check = FALSE)