Skip to contents

Defunct. Please use rsDriver or phantomjs

Usage

phantom(pjs_cmd = "", port = 4444L, extras = "", ...)

Arguments

pjs_cmd

The name, full or partial path of a phantomjs executable. This is optional only state if the executable is not in your path.

port

An integer giving the port on which phantomjs will listen. Defaults to 4444. format [[<IP>:]<PORT>]

extras

An optional character vector: see 'Details'.

...

Arguments to pass to system2

Details

phantom A utility function to control a phantomjs binary in webdriver mode.

Detail

phantom() is used to start a phantomjs binary in webdriver mode. This can be used to drive a phantomjs binary on a machine without selenium server. Argument extras can be used to specify optional extra command line arguments see http://phantomjs.org/api/command-line.html

Value

phantom() returns a list with two functions:

getPID

returns the process id of the phantomjs binary running in webdriver mode.

stop

terminates the phantomjs binary running in webdriver mode using pskill

Examples

if (FALSE) {
pJS <- phantom()
# note we are running here without a selenium server phantomjs is
# listening on port 4444
# in webdriver mode
remDr <- remoteDriver(browserName = "phantomjs")
remDr$open()
remDr$navigate("http://www.google.com/ncr")
remDr$screenshot(display = TRUE)
webElem <- remDr$findElement("name", "q")
webElem$sendKeysToElement(list("HELLO WORLD"))
remDr$screenshot(display = TRUE)
remDr$close()
# note remDr$closeServer() is not called here. We stop the phantomjs
# binary using
pJS$stop()
}