'Webdriver'/'Selenium' Binary Manager

There are a number of binary files associated with the 'Webdriver'/'Selenium' project (see < http://www.seleniumhq.org/download/>, < https://sites.google.com/a/chromium.org/chromedriver/>, < https://github.com/mozilla/geckodriver>, < http://phantomjs.org/download.html> and < https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver> for more information). This package provides functions to download these binaries and to manage processes involving them.


CRAN version Travis build status Appveyor build status Coverage
Build Status AppVeyor Build Status codecov

You can install wdman from github with:

# install.packages("devtools")
devtools::install_github("johndharrison/wdman")

The package can also be installed from CRAN:

install.packages("wdman")

Introduction

wdman (Webdriver Manager) is an R package that allows the user to manage the downloading/running of third party binaries relating to the webdriver/selenium projects. The package was inspired by a similar node package webdriver-manager.

The checking/downloading of binaries is handled by the binman package and the running of the binaries as processes is handled by the subprocess package.

The wdman package currently manages the following binaries:

Associated with the above are five functions to download/manage the binaries:

  • selenium(...)
  • chrome(...)
  • phantomjs(...)
  • gecko(...)
  • iedriver(...)

Example

As an example we show how one would run the Selenuium standalone binary as a process:

Running the Selenium binary

The binary takes a port argument which defaults to port = 4567L. There are a number of optional arguments to use a particular version of the binaries related to browsers selenium may control. By default the selenium function will look to use the latest version of each.

selServ <- selenium(verbose = FALSE)
selServ$process

## Process Handle
## command   : /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -Dwebdriver.chrome.driver=/home/john/.local/share/binman_chromedriver/linux64/2.27/chromedriver -Dwebdriver.gecko.driver=/home/john/.local/share/binman_geckodriver/linux64/0.13.0/geckodriver -Dphantomjs.binary.path=/home/john/.local/share/binman_phantomjs/linux64/2.1.1/phantomjs-2.1.1-linux-x86_64/bin/phantomjs -jar /home/john/.local/share/binman_seleniumserver/generic/3.0.1/selenium-server-standalone-3.0.1.jar -port 4567
## system id : 105698
## state     : running

The selenium function returns a list of functions and a handle representing the running process.

The returned output, error and log functions give access to the stdout/stderr pipes and the cumulative stdout/stderr messages rerspectively.

selServ$log()

## $stderr
##  [1] "10:28:57.720 INFO - Selenium build info: version: '3.0.1', revision: '1969d75'"                                                                                          
##  [2] "10:28:57.721 INFO - Launching a standalone Selenium Server"                                                                                                              
##  [3] "2017-01-17 10:28:57.736:INFO::main: Logging initialized @186ms"                                                                                                          
##  [4] ""                                                                                                                                                                        
##  [5] "10:28:57.780 INFO - Driver provider org.openqa.selenium.ie.InternetExplorerDriver registration is skipped:"                                                              
##  [6] " registration capabilities Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}] does not match the current platform LINUX"
##  [7] "10:28:57.781 INFO - Driver provider org.openqa.selenium.edge.EdgeDriver registration is skipped:"                                                                        
##  [8] " registration capabilities Capabilities [{browserName=MicrosoftEdge, version=, platform=WINDOWS}] does not match the current platform LINUX"                             
##  [9] "10:28:57.781 INFO - Driver class not found: com.opera.core.systems.OperaDriver"                                                                                          
## [10] "10:28:57.782 INFO - Driver provider com.opera.core.systems.OperaDriver registration is skipped:"                                                                         
## [11] "Unable to create new instances on this machine."                                                                                                                         
## [12] "10:28:57.782 INFO - Driver class not found: com.opera.core.systems.OperaDriver"                                                                                          
## [13] "10:28:57.783 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered"                                                                                
## [14] "10:28:57.784 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:"                                                                    
## [15] " registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform LINUX"                                        
## [16] "2017-01-17 10:28:57.815:INFO:osjs.Server:main: jetty-9.2.15.v20160210"                                                                                                   
## [17] ""                                                                                                                                                                        
## [18] "2017-01-17 10:28:57.836:INFO:osjsh.ContextHandler:main: Started [email protected]{/,null,AVAILABLE}"                                                
## [19] ""                                                                                                                                                                        
## [20] "2017-01-17 10:28:57.849:INFO:osjs.ServerConnector:main: Started [email protected]{HTTP/1.1}{0.0.0.0:4567}"                                                        
## [21] ""                                                                                                                                                                        
## [22] "2017-01-17 10:28:57.851:INFO:osjs.Server:main: Started @301ms"                                                                                                           
## [23] ""                                                                                                                                                                        
## [24] "10:28:57.852 INFO - Selenium Server is up and running"                                                                                                                   
## 
## $stdout
## character(0)

The stop function sends a signal that terminates the process:

selServ$stop()

## [1] TRUE

Available browsers

By default the selenium function includes paths to chromedriver/geckodriver/ phantomjs so that the Chrome/Firefox and PhantomJS browsers are available respectively. All versions (chromever, geckover etc) are given as "latest". If the user passes a value of NULL for any driver it will be excluded.

On Windows operating systems the option to included the Internet Explorer driver is also given. This is set to iedrver = NULL so not ran by default. Set it to iedrver = "latest" or a specific version string to include it on your Windows.

Further details

For further details please see the package vignette:

wdman: Basics

News

wdman 0.2.2

  • Moved unix based systems to write pipes to file.
  • Fixed issue with shell escaping paths.

wdman 0.2.1

  • Added a read_pipes internal function for windows drivers
  • Fixed an issue with Windows and blocking pipes. A batch file is now ran with stdout/stderr piped to file.

wdman 0.2.0

  • Added verbose arguments to the driver functions
  • Import semver for parsing semantic versions
  • Added basic vignette on operation.
  • Set default PhantomJS version to 2.1.1 (2.5.0-beta runs old ghostdriver currently).
  • Added a check argument to all driver functions.
  • Added tests and refactored code.

wdman 0.1.5

  • Use binman::sem_ver for versioning.
  • Remove the v in gecko versions.
  • Improve logging in selenium function.

wdman 0.1.4

  • Added tests for driver functions.

wdman 0.1.3

  • Added selenium function.
  • Added iedriver function.

wdman 0.1.2

  • Added phantomjs function.

wdman 0.1.1

  • Added chrome function.
  • Added gecko function.

wdman 0.1.0

  • Added a NEWS.md file to track changes to the package.

Reference manual

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

install.packages("wdman")

0.2.2 by John Harrison, a year ago


https://github.com/johndharrison/wdman


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


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


Authors: John Harrison [aut, cre] (R package wdman)


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports binman, assertthat, subprocess, yaml, semver, utils

Suggests testthat, covr, knitr, rmarkdown


See at CRAN