晚上好,我写这个问题是因为我的Rselenium有问题。我每天都在R中使用硒,但是从昨天开始它已经停止工作。我的代码是:
> library(RSelenium)
driver <- rsDriver(remoteServerAddr = "localhost", port=4445L, browser=c("firefox"), version = "latest")
错误消息是:
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": "firefox",
"javascriptEnabled": true,
"nativeEvents": true,
"version": "",
"platform": "ANY"
},
"capabilities": {
"firstMatch": [
{
"browserName": "firefox"
}
]
}
}
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'PC3', ip: '192.168.1.151', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_221'
Driver info: driver.version: unknown
Could not open firefox 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.
真正的问题是,在昨天之前脚本起作用了。
有关工具的版本为:
Java是1.8.0_221-b11
RStudio是1.2.1335
Firefox是69.0(64bit)
Windows 10 Pro 64位
我没有更改代码。我不知道发生了什么事?
非常感谢您提供任何有用的帮助。
弗朗切斯科
我认为网络上没有很好的帮助,但是我得到了完全相同的错误代码,发现它可以与此代码一起使用:
require(RSelenium)
ff64 = "c:/PROGRAMS/Firefox/FirefoxPortable/App/Firefox64/firefox.exe"
pr64 <- list(`moz:firefoxOptions` = list(binary = ff64), pageLoadStrategy = 'none')
rs <- rsDriver(browser = "firefox", port = 4567L, extraCapabilities = c(ff64, pr64))
rd <- rs[['client']]
现在它以rd$open()
打开
只是指出了我想运行的应用程序的物理路径(在我的情况下,调用了其他FF)。仅在64位Win-7上使用FF测试。希望这会有所帮助。