Ale*_*lex 5 selenium r phantomjs selenium-webdriver
我正在尝试将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()
Run Code Online (Sandbox Code Playgroud)
这导致:
$class
[1] "org.openqa.selenium.UnsupportedCommandException"
$additionalInformation
[1] "\nDriver info: driver.version: unknown"
Run Code Online (Sandbox Code Playgroud)
我sessionInfo()在下面:
$class
[1] "org.openqa.selenium.UnsupportedCommandException"
$additionalInformation
[1] "\nDriver info: driver.version: unknown"
Run Code Online (Sandbox Code Playgroud)
更新:不幸的是,下面的解决方案似乎不起作用:
[1] "Connecting to remote server"
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: java.lang.ClassNotFoundException
Run Code Online (Sandbox Code Playgroud)
此问题已修复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()
Run Code Online (Sandbox Code Playgroud)
更新:
这似乎是新的 2.44 selenium 服务器和 Ghostdriver 的问题,目前您可以在没有 Selenium Server 的情况下直接驱动 phantom,直到问题在上游得到解决,或者您可以使用旧版本的 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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1947 次 |
| 最近记录: |