7

Cannot start a new session with phantomjs using rsDriver. Other browsers work fine, but when i try the option of phantomjs it does not work and I cannot fully grasp the meaning of the output of the error. How can I solve this?

require(RSelenium)
remDr=rsDriver(port = 4460L, browser = c("phantomjs"))
checking Selenium Server versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking chromedriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking geckodriver versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
checking phantomjs versions:
BEGIN: PREDOWNLOAD
BEGIN: DOWNLOAD
BEGIN: POSTDOWNLOAD
[1] "Connecting to remote server"

Selenium message:Unable to create session from {
  "desiredCapabilities": {
    "browserName": "phantomjs",
    "javascriptEnabled": true,
    "nativeEvents": true,
    "version": "",
    "platform": "ANY"
  },
  "capabilities": {
    "firstMatch": [
      {
        "browserName": "phantomjs"
      }
    ]
  }
}
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'LAPTOP-302FGG7N', ip: '192.168.0.3', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_231'
Driver info: driver.version: unknown

Could not open phantomjs browser.
Client error message:
     Summary: SessionNotCreatedException
     Detail: A new session could not be created.
     Further Details: run errorDetails method
Check server log for further details.
John Doe
  • 212
  • 1
  • 9
  • 28

1 Answers1

0

I have been able to use pĥantomjs with the following code :

library(RSelenium)
library(wdman)

url <- "http://www.verema.com/vinos/portada"
port <- as.integer(4444L + rpois(lambda = 1000, 1))
pJS <- wdman::phantomjs(port = port)
remDrPJS <- remoteDriver(browserName = "phantomjs", port = port)
remDrPJS$open()
remDrPJS$navigate(url)
remDrPJS$screenshot(TRUE)
Emmanuel Hamel
  • 1,769
  • 7
  • 19