【发布时间】:2016-06-02 22:52:06
【问题描述】:
我正在尝试使用带有 Chrome 驱动程序的 RSelenium 包打开远程驱动程序并遇到以下错误:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: java.lang.IllegalStateException
之前在 stackoverflow 上已经提出过这个问题,但是 solution(我已经完全尝试过)没有用。我也咨询了this和this。
我在 R 中的基本代码如下。错误发生在以下行remDr$open() 之后。
install.packages("RSelenium")
library(RSelenium)
checkForServer()
startServer()
Sys.sleep(5.0)
remDr <- remoteDriver( browserName="chrome" )
remDr$open()
规格:
- R:v.3.3.0
- 使用 RStudio v.0.99.902 在 R 中工作
- 操作系统:OSX El Capital 10.11.3
- Java:1.8.92.14
- 我还下载了chrome驱动v2.21here。它目前位于应用程序中自己的文件夹中。
为了解决这个问题,我已经尝试过:
- 以下
startServer()命令的两个替代版本。第一个抛出同样的错误,第二个也告诉我No Selenium Server binary exists. Run checkForServer or start server manually.-
startServer(args = c("-Dwebdriver.chrome.driver=/mypath/to/chromedriver.exe") , log = FALSE, invisible = FALSE) - 和
startServer(dir = FALSE, args = c("-Dwebdriver.chrome.driver=/mypath/to/chromedriver.exe") , log = FALSE, invisible = FALSE)
-
- 在终端中运行以下命令(并在运行 R 代码时保持终端打开):
java -jar /mypath/to/selenium-server-standalone.jar -Dwebdriver.chrome.driver=/mypath/to/chromedriver.exe。这引发了同样的错误。 - 创建一个
.command文件,其中包含我之前在上述终端中输入的信息 (2),并在 R 中调用该文件,如下所示。
.
install.packages("RSelenium")
library(RSelenium)
system(paste("open","/mypath/command.command")
remDr <- remoteDriver( browserName="chrome" )
remDr$open()
这导致了以下错误The file could not be executed because you do not have appropriate access privileges. 在 Finder 中导航到 .command 文件并将所有共享和权限更改为读写并没有更改错误消息。
重新安装所有组件 - Chrome 驱动程序、Selenium
.jar文件、包RSelenium。重新启动 R。更新 R 和 RStudio。使用像
remDr <- remoteDriver$new()这样的默认远程驱动程序(我相信是 Firefox)。不同的错误:class: org.openqa.selenium.WebDriverException。更新 Firefox 以帮助上述 5 无济于事。
我们将不胜感激。
【问题讨论】:
-
不知道,但似乎您在尝试修复方面非常彻底。
-
我在 Windows 上遇到同样的错误。使用
startServer(log = FALSE, invisible = FALSE)打开服务器控制台,然后您可能会遇到错误。它适用于 Firefox -
谢谢!我试过了(使用 Chrome 和 Firefox)。我没有打开“服务器控制台”(不确定这意味着什么),但我得到了一个不同的错误:
org.openqa.selenium.WebDriverException。 @HubertL
标签: java r google-chrome selenium