2

I am attempting to move an rselenium script to a raspberry pi 3. Before going into and editing the script, I am testing if it is possible to run rselenium on the pi by just attempting simple open and navigate commands.

R version is 3.6.1.

I started trying to use Chromium and Firefox, downloading chrome driver and gecko, but was unable to open a browser from the command line. So I moved onto headless browsers:

Current script using phantomjs is:

library(RSelenium)

pJS <- wdman::phantomjs(pjs_cmd = "phantomjs-raspberrypi/bin/phantomjs") 

remDr <- remoteDriver(browserName = c("phantomjs"))

remDr$open

remDr$navigate("https://www.google.com/ncr")

remDr$getTitle()[[1]]

remDr$close

pJS$stop()

and also attempted initialising using Firefox ESR 52.9.0(32-bit) with gecko driver 0.16.1:

driver<- rsDriver(
  browser = "firefox", geckover = "latest",
  extraCapabilities = list(
    "moz:firefoxOptions" = list(
      args = list('-headless')
    )
  )
)

Error message currently output is:

Error in checkError(res)
undefined error in httr call. httr output: length(url) == 1 is not TRUE

A search of the web hasn't helped in interpreting this error.

I suspect I am missing a dependency that enables the pi to use Rselenium but I cannot find guidelines or package readme guides that are pi specific or from more recent than several updated versions previously.

The command

firefox -headless

opens a browser from the command line but a script can't replicate this seemingly.

At this point I am simply looking to test whether this task is possible on the pi by opening and executing a simple collect title command. Are there any users who have used a raspberry pi in this manner that could provide a list of required dependencies or a reproducible example of activating a phantom browser?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.