Rselenium并行:尝试在节点中打开页面时出错

时间:2017-10-06 15:24:38

标签: r rselenium doparallel

在以下网站:Run RSelenium in parallel,我找到了如何使用并行包并行打开多个浏览器(会话):

 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()

})

但是,如果我只添加一行打开特定页面的代码:

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/")
})

它会返回错误:

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

为什么它会使用这一额外的代码行返回错误?

还有一件奇怪的事情。它有时适用于第一,但如果我尝试更多次,它会一直返回错误。

0 个答案:

没有答案