R Client Implementing the W3C WebDriver Specification

The W3C WebDriver specification defines a way for out-of-process programs to remotely instruct the behaviour of web browsers. It is detailed at < https://w3c.github.io/webdriver/webdriver-spec.html>. This package provides an R client implementing the W3C specification.

CRAN version Travis build status SauceTests Coverage
Build Status Sauce Test Status codecov

Sauce Test Status

A lightweight implementation of w3c webdriver specification


seleniumPipes is a lightweight implementation of the w3c webdriver specification. It has been built utilising xml2, httr and magrittr so provides an alternative for users who are familiar with piping.


To install seleniumPipes from CRAN


To install the current developement version of seleniumPipes run:


Getting started

The easiest way to start is to look at the Basic operations vignette:

Failing this a few basic examples are presented below:

Get started using seleniumPipes you can look at the following example

library(RSelenium) # start a server with utility function
selServ <- RSelenium::startServer()
remDr <- remoteDr()
remDr %>% go(url = "http://www.google.com")
remDr %>% go(url = "http://www.bbc.com")
remDr %>% back()
remDr %>% forward()
remDr %>% refresh()
remDr %>% go("https://cloud.r-project.org/") %>% getPageSource()
# {xml_document}
# <html>
# [1] <head>\n<title>The Comprehensive R Archive Network</title>\n<meta content="text/html; charset=u ...
# [2] <frameset style="border: none;" cols="1*, 4*">\n<frameset rows="120, 1*">\n<frame frameborder=" ...

remDr %>% getPageSource() %>% xml_find_all("//frame") %>% xml_attr("name")
# [1] "logo"     "contents" "banner"  

remDr %>% deleteSession()


Piping in seleniumPipes is achieved using the pipe operator from magrittr%>%`:

remDr %>% go("http://www.google.com/ncr") %>% 
  findElement("name", "q") %>% 
  elementSendKeys("R project", key = "enter")

Functions relating to the remote driver which would not be expected to return data can be expected to return the remote driver. Functions relating to a web element which would not be expected to return data can be expected to return the web element. This allows chaining of commands as shown above.

Further examples are available on install in the examples directory.

Builtin retry of Endpoints

remDr <- remoteDr()
webElem <- remDr %>% go("http://www.google.com/ncr") %>% 
  findElement("name", "q")

# change the name of q with an 8 second delay
myscript <- "var myElem = arguments[0]; window.setTimeout(function(){
}, 8000);"
remDr %>% executeScript(myscript, args = list(webElem))

newWebElem <- remDr %>% findElement("name", "funkyname")

# > newWebElem <- remDr %>% findElement("name", "funkyname")
# Calling  findElement  - Try no:  1  of  3 
# Calling  findElement  - Try no:  2  of  3 

newWebElem %>% getElementAttribute("name")


seleniumpipes 0.3.7

  • Set CRAN URL's in canonical form

seleniumpipes 0.3.6

  • Move testing to version 2.53.1
  • Update basic operation vignette

seleniumpipes 0.3.5

  • suggests RSauceLabs for polling SauceLabs.com API now on CRAN

seleniumpipes 0.3.4

  • Add sauceLabs test to travis

seleniumpipes 0.3.3

  • Fix issue with maximiseWindow
  • Add further tests and increase test coverage

seleniumpipes 0.3.2

  • Fix issue with switchToParentFrame
  • Add further tests and increase test coverage

seleniumpipes 0.3.1

  • Add testing on Travis and testing locally using Docker containers

seleniumpipes 0.3.0

  • Initial release to CRAN

seleniumpipes 0.2.7

  • A vignette on basic operation has been added
  • The retry argument can now be passed in all functions and is detailed at ?retry

seleniumpipes 0.2.6

  • Complete documentation of package fuinctions.
  • The option to retry failing calls to endpoints on the remote server has been added

seleniumpipes 0.2.5

  • Add documentation for initial functions.
  • Add documentation for cookie group of functions.
  • Move documentation to templates.

seleniumpipes 0.2.4

  • Add support for multiple sessions

seleniumpipes 0.2.3

  • Add tests on the API in the tests directory. (inst/tests pre-install as Selenium Server needed)

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.3.7 by John Harrison, 5 years ago


Report a bug at https://github.com/johndharrison/seleniumPipes/issues

Browse source code at https://github.com/cran/seleniumPipes

Authors: John Harrison [aut, cre]

Documentation:   PDF Manual  

Task views: Web Technologies and Services

GPL-3 license

Depends on httr, jsonlite, xml2, magrittr, whisker

Suggests knitr, rmarkdown, data.table, testthat, covr, RSauceLabs

See at CRAN