How would i go about running RSelenium
in parallel.
The following is an example using rvest
in parallel
library(RSelenium)
library(rvest)
library(magrittr)
library(foreach)
library(doParallel)
URLsPar <- c("http://www.example.com/", "http://s5.tinypic.com/n392s6_th.jpg", "http://s5.tinypic.com/jl1jex_th.jpg",
"http://s6.tinypic.com/16abj1s_th.jpg", "http://s6.tinypic.com/2ymvpqa_th.jpg")
(detectCores() - 1) %>% makeCluster %>% registerDoParallel
ws <- foreach(x = 1:length(URLsPar), .packages = c("rvest", "magrittr", "RSelenium")) %dopar% {
URLsPar[x] %>% read_html %>% as("character")}
stopImplicitCluster()
open
method of theremoteDriver
class. In terms of your workflowseleniumPipes
might be appropriate github.com/johndharrison/seleniumPipes – NymphetregisterDoParallel
, whould i need toopen
3 instances prior to theforeach
? I didn't know about theseleniumPipes
! thnx – Cilicia