gpt4 book ai didi

r - 在 Windows 7 上使用 phantomjs 和 RSelenium

转载 作者:行者123 更新时间:2023-12-01 17:38:19 25 4
gpt4 key购买 nike

我正在尝试将 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 的情况下直接驱动 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

关于r - 在 Windows 7 上使用 phantomjs 和 RSelenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26566894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com