无法在RSelenium中使用phantomjs启动会话

yeotifhr  于 2023-04-09  发布在  其他
关注(0)|答案(1)|浏览(93)

无法使用rsDriver启动与phantomjs的新会话。其他浏览器工作正常,但当我尝试phantomjs的选项时,它不起作用,我无法完全掌握错误输出的含义。我如何解决这个问题?

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.
yyyllmsg

yyyllmsg1#

我已经能够使用pantomjs与以下代码:

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)

相关问题