Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using phantomjs with RSelenium on windows 7

I am trying to use PhantomJS with RSelenium and seem to be having trouble:

require(RSelenium)
RSelenium::startServer()
remDr <- remoteDriver(browserName = "phantomjs", extraCapabilities = list(phantomjs.binary.path =    "C:/Users/home/Desktop/phantomjs-1.9.8-windows/phantomjs.exe"))
remDr$open()

This results in:

$class
[1] "org.openqa.selenium.UnsupportedCommandException"

$additionalInformation
[1] "\nDriver info: driver.version: unknown"

My sessionInfo() is below:

$class
[1] "org.openqa.selenium.UnsupportedCommandException"

$additionalInformation
[1] "\nDriver info: driver.version: unknown"

UPDATE: Unfortunately the solution below does not seem to work:

[1] "Connecting to remote server"
Error:   Summary: UnknownError
         Detail: An unknown server-side error occurred while processing the command.
         class: java.lang.ClassNotFoundException
like image 268
Alex Avatar asked Oct 31 '22 15:10

Alex


1 Answers

This issue was fixed https://github.com/ropensci/RSelenium/commit/462ff26eb0e5578181b80cb5bc002ac1e8e68306. Can you try the following:

devtools::install_github("ropensci/RSelenium")
require(RSelenium)
psPath <- "C:/Users/home/Desktop/phantomjs-1.9.8-windows/phantomjs.exe"
RSelenium::startServer()
remDr <- remoteDriver(browserName = "phantomjs"
                      , extraCapabilities = list(phantomjs.binary.path = psPath))
remDr$open()

UPDATE:

This appears to be an issue with the new 2.44 selenium server and ghostdriver for now you can drive phantom directly without a Selenium Server until the issue is fixed upstream or you can use an older version of Selenium Server (2.43 was working with ghostdriver):

# DRIVE phantomJS DIRECTLY
require(RSelenium)
# devtools::install_github("ropensci/RSelenium") # if the latest dev version is not currently installed
psPath <- "C:/Users/home/Desktop/phantomjs-1.9.8-windows/phantomjs.exe"
pJS <- phantom(pjs_cmd = psPath)
remDr <- remoteDriver(browserName = "phantomjs")
remDr$open()
# pJS$stop() # to close phantom server
like image 174
jdharrison Avatar answered Nov 15 '22 06:11

jdharrison