I have the following code in R:
library(RSelenium)
shell('docker run -d -p 4446:4444 selenium/standalone-firefox')
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4446L, browserName = "firefox")
remDr$open()
remDr$navigate("http://www.google.com/ncr")
remDr$getTitle()
When running it, it freezes at the following stage and nothing happens:
> remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4446L, browserName = "firefox")
> remDr$open()
[1] "Connecting to remote server"
I suspect it could be because I usually use Chrome as my browser, but even if I change the browser name to chrome as per the below, same issue:
remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4446L, browserName = "chrome")
I then also tried the following:
driver <- rsDriver(port = 4446L, browser = "chrome", chromever = NULL)
This gave the following result:
checking Selenium Server 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:Unable to create new service: ChromeDriverService
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'DESKTOP-HKH3SN0', ip: '10.0.0.10', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_371'
Driver info: driver.version: unknown
Could not open chrome browser.
Client error message:
Summary: SessionNotCreatedException
Detail: A new session could not be created.
Further Details: run errorDetails method
Check server log for further details.
Checking the log details:
$stderr
[1] "13:03:54.084 INFO [GridLauncherV3.parse] - Selenium server version: 4.0.0-alpha-2, revision: f148142cf8"
[2] "13:03:54.218 INFO [GridLauncherV3.lambda$buildLaunchers$3] - Launching a standalone Selenium Server on port 4446"
[3] "13:03:54.606 INFO [WebDriverServlet.<init>] - Initialising WebDriverServlet"
[4] "13:03:55.183 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4446"
[5] "13:03:56.274 INFO [ActiveSessionFactory.apply] - Capabilities are: {"
[6] " \"browserName\": \"chrome\","
[7] " \"javascriptEnabled\": true,"
[8] " \"nativeEvents\": true,"
[9] " \"version\": \"\""
[10] "}"
[11] "13:03:56.275 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.grid.session.remote.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)"
$stdout
character(0)
I'm having the exact same problem right now and searching for ideas. There is an issue thread in RSelenium github which is discussing this problem (https://github.com/ropensci/RSelenium/issues/275). I have not been able to resolve the issue by loading the latest wdman version mentioned as a possible fix. However, as part of my testing I was running an older version in parallel which had no issues and found that moving to an older selenium chrome image (e.g. 4.2.2) fixes the open hang
So on the new server I pulled the 4.2.2 image
docker pull selenium/standalone-chrome:4.2.2
and called that explicitly in the docker command
docker run -d -p 4445:4444 --shm-size 4g selenium/standalone-chrome:4.2.2
and from there I'm able to construct and open the remote driver object