from RSelenium vignette, RPubs, and Docker GitHub
RSelenium moved to using Docker, which allows to standardize package behavior across operating systems, and therefore remove all concomitant issues.
Download and Install
- Docker, an environment to run Selenium server.
- TightVNC, a viewer to observe the result of RSelenium navigation commands.
Setup Docker to work with Selenium
- Enable hardware virtualization. It is sufficient to enable it in BIOS, and subsequent steps are unnecessary.
If you don’t have it enabled, Docker will throw the following error:
This computer doesn't have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory.
- Save this json file as
Upon starting, Docker will download
Without it, you most likely will see the following error upon Docker launch:
No default Boot2Docker ISO found locally, downloading the latest release...
Docker Quickstart Terminal. You should see a console prompt similar to this one:
- In Docker Terminal run the following commands:
$ docker pull selenium/standalone-chrome $ docker run -d -p 4445:4444 selenium/standalone-chrome
A full list of Selenium Docker images is available here.
- Alternatively, for debug mode (to enable viewing results of RSelenium navigation) use:
$ docker pull selenium/standalone-chrome-debug $ docker run -d -p 5901:5900 -p 4445:4444 selenium/standalone-chrome-debug
Then start the
In the prompt, enter
Remote Host:and click
In the next window enter
The result of all RSelenium navigation commands can be seen in this window.
Connect R Session to Selenium Server
In R, create a
remoteDriver object, and navigate to a desired url:
#load RSelenium package require(RSelenium) #point to the remote server remDr<- remoteDriver(remoteServerAddr = "192.168.99.100" , port = 4445L , browserName = "chrome" ) #navigate to url remDr$open() remDr$navigate("https://www.google.com/")