On following site: Run RSelenium in parallel, I have found out how to open multiply browsers (sessions) in parallel using parallel package:
library(RSelenium)
library(rvest)
library(magrittr)
library(foreach)
library(doParallel)
# number of cores
(cl <- (detectCores() - 1) %>% makeCluster) %>% registerDoParallel
# open a remoteDriver for each node on the cluster
# docker run -d -p 4445:4444 selenium/standalone-chrome:3.4.0
clusterEvalQ(cl, {
library(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "192.168.99.100", port = 4445L,
browserName = "chrome")
remDr$open()
})
But if I add only one additional line of code that open specific page:
clusterEvalQ(cl, {
library(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "192.168.99.100", port = 4445L,
browserName = "chrome")
remDr$open()
Sys.sleep(3L)
remDr$navigate("http://plovila.pomorstvo.hr/")
})
it returns an error:
Error in checkForRemoteErrors(lapply(cl, recvResult)) :
6 nodes produced errors; first error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.WebDriverException
Further Details: run errorDetails method
Why it returns an error with this additional line of code?
There is one more strange thing. It sometimes works at firs, but after if I try more times it returns an error all the time.