6

My OS is windows 8.1 and I have the version 3.3.3 of R.

I have installed the RSelenium packages and I try to run it using this:

library("RSelenium")
#start RSelenium server
startServer()
checkForServer()

and I receive this error:

Error: checkForServer is now defunct. Users in future can find the function in 
file.path(find.package("RSelenium"), "examples/serverUtils"). The
recommended way to run a selenium server is via Docker. Alternatively
see the RSelenium::rsDriver function.

Is there anything changed in the way RSelenium opens? I search for the error and I found only this but it doesn't help me. What can I do?

Also an alternative I tried is to download the chromedrive from here 'https://sites.google.com/a/chromium.org/chromedriver/downloads'

and using this script: require(RSelenium) cprof <- getChromeProfile("C:/Users/Peri/Desktop/chromedriver/chromedriver.exe", "Profile 1")

require(RSelenium)
remDr <- remoteDriver(remoteServerAddr = "localhost" 
                      , port = 4444
                      , browserName = "chrome", extraCapabilities = cprof
)
remDr$open()

and I receive this error:

Error in checkError(res) : 
  Couldnt connect to host on http://localhost:4444/wd/hub.
  Please ensure a Selenium server is running.

what can I do to run chrome instead of the pre-default browser Firefox?

Keri
  • 375
  • 1
  • 3
  • 14
  • 1
    Did you try the vignette http://rpubs.com/johndharrison/RSelenium-Basics . It outlines using Docker and also rsDriver in the appendix. – jdharrison Mar 15 '17 at 14:51
  • @jdharrison I tried the standalone version of selenium from cmd and run RSelenium after and I can open chrome but I can give a simple `remDr$navigate("www.google.com")` – Keri Mar 15 '17 at 14:55
  • Follow the basic vignette http://rpubs.com/johndharrison/RSelenium-Basics and docker http://rpubs.com/johndharrison/RSelenium-Docker . You would need the full html path `remDr$navigate("http://www.google.com")` – jdharrison Mar 15 '17 at 14:56
  • refer https://stackoverflow.com/questions/45395849/cant-execute-rsdriver-connection-refused https://stackoverflow.com/questions/42468831/how-to-set-up-rselenium-for-r – Nad Pat Sep 16 '21 at 06:38

1 Answers1

1

You need to use the function rsDriver. The Selenium Version wants you to use Docker (which I also would recommend), but if you are not familiar with this you can go this way.

rsdriver will manage the binaries needed for running a Selenium Server. This provides a wrapper around the wdman::selenium function.

Here is what you have to do to start a Chrome Browser:

driver<- rsDriver()
remDr <- driver[["client"]]

And then you can work with it:

remDr$navigate("http://www.google.de")
remDr$navigate("http://www.spiegel.de")

And stop it:

remDr$close()
DanielS
  • 816
  • 8
  • 16