Search code examples
rweb-scrapingrselenium

Webscraping with RSelenium : server issue


I am trying to webscrape with RSelenium, bacause I need to scrape what's on a page (with 'rvest') and them click on many links to scrape another info (probabyl also with rvest). Therefore, I need RSelenium to click on those links.

However, I am not able yet to launch RSelenium. When I run rsDrvier() :

rD <- rsDriver(port=9515L,
           browser=c("chrome"),
           version="4.0.0-alpha-2",
           chromever="103.0.5060.53")

I get an error message

checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
Error in `[[<-`(`*tmp*`, platvec, value = switch(Sys.info()["sysname"],  : 
no such index at level 1

I've already downloaded JAVA and chromedriver. I've already put their PATH in the system.

Note that I'm using : Windows 11 R version : 4.0.3 Chrome version : 103.0.5060.53

Thanks for you help !


Solution

  • If docker is installed on your computer, you can consider something like this to use RSelenium with firefox :

    library(RSelenium)
    url <- "xxx"
    shell('docker run -d -p 4445:4444 selenium/standalone-firefox')
    remDr <- remoteDriver(remoteServerAddr = "localhost", port = 4445L, browserName = "firefox")
    remDr$open()
    remDr$navigate(url)