加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

在Windows 7上使用带有RSelenium的phantomjs

发布时间:2020-12-14 02:50:50 所属栏目:Windows 来源:网络整理
导读:我正在尝试将PhantomJS与RSelenium一起使用并且似乎遇到了麻烦: require(RSelenium)RSelenium::startServer()remDr - remoteDriver(browserName = "phantomjs",extraCapabilities = list(phantomjs.binary.path = "C:/Users/home/Desktop/phantomjs-1.9.8-w
我正在尝试将PhantomJS与RSelenium一起使用并且似乎遇到了麻烦:

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()

这导致:

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

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

我的sessionInfo()如下:

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

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

更新:
不幸的是,下面的解决方案似乎不起作用:

[1] "Connecting to remote server"
Error:   Summary: UnknownError
         Detail: An unknown server-side error occurred while processing the command.
         class: java.lang.ClassNotFoundException

解决方法

此问题已修复 https://github.com/ropensci/RSelenium/commit/462ff26eb0e5578181b80cb5bc002ac1e8e68306.您可以尝试以下方法:

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()

更新:

这似乎是新的2.44 selenium服务器和ghostdriver的问题,现在你可以在没有Selenium Server的情况下直接驱动幻像,直到问题在上游修复,或者你可以使用旧版本的Selenium Server(2.43正在使用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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读