为什么RSelenium中的rsDriver在R中即使删除许可证后仍然存在错误.chromedriver文件?<



各位会员:我正在使用RSelenium,并在使用rsDriver时获得以下错误信息:

> rD <- rsDriver(port=free_port(random=TRUE),browser="chrome",chromever="109.0.5414.25",verbose=FALSE)
Could not open chrome browser.
Client error message:
Undefined error in httr call. httr output: Failed to connect to localhost port 795: Connection refused
Check server log for further details.
Warning message:
In rsDriver(port = free_port(random = TRUE), browser = "chrome",  :
Could not determine server status.

我已经成功删除了LICENSE。这里提到的Chromedriver文件:https://github.com/ropensci/wdman/issues/31

但是我没有靴子…请帮助…

selenium的输出(retcommand =T)

> library(wdman)
> selenium(retcommand = T)
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] "C:\PROGRA~1\COMMON~1\Oracle\Java\javapath\java.exe -Dwebdriver.chrome.driver="C:\Users\Administrator\AppData\Local\binman\binman_chromedriver\win32\110.0.5481.30/chromedriver.exe" -Dwebdriver.gecko.driver="C:\Users\Administrator\AppData\Local\binman\binman_geckodriver\win64\0.32.0/geckodriver.exe" -Dphantomjs.binary.path="C:\Users\Administrator\AppData\Local\binman\binman_phantomjs\windows\2.1.1/phantomjs-2.1.1-windows/bin/phantomjs.exe" -jar "C:\Users\Administrator\AppData\Local\binman\binman_seleniumserver\generic\4.0.0-alpha-2/selenium-server-standalone-4.0.0-alpha-2.jar" -port 4567"

更改颜色后的错误提示= "110.0.5481.30":

>  rD <- rsDriver(port=free_port(random=TRUE),browser="chrome",chromever="110.0.5481.30",verbose=FALSE)
Selenium message:session not created: This version of ChromeDriver only supports Chrome version 110
Current browser version is 109.0.5414.75 with binary path C:Program FilesGoogleChromeApplicationchrome.exe
Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
System info: host: 'EC2AMAZ-1JRGETJ', ip: '172.31.9.48', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.1'
Driver info: driver.version: unknown
remote stacktrace: Backtrace:
(No symbol) [0x00C53643]
(No symbol) [0x00BE8981]
(No symbol) [0x00AEB35D]
(No symbol) [0x00B0ED2D]
(No symbol) [0x00B09B50]
(No symbol) [0x00B06F89]
(No symbol) [0x00B41EB5]
(No symbol) [0x00B41B0C]
(No symbol) [0x00B3B1F6]
(No symbol) [0x00B10D57]
(No symbol) [0x00B124FD]
GetHandleVerifier [0x00ECB5F2+2513186]
GetHandleVerifier [0x00EFB730+2710112]
GetHandleVerifier [0x00EFECDC+2723852]
GetHandleVerifier [0x00D02250+640384]
(No symbol) [0x00BF1142]
(No symbol) [0x00BF6AD8]
(No symbol) [0x00BF6BBB]
(No symbol) [0x00C009FB]
BaseThreadInitThunk [0x768262C4+36]
RtlSubscribeWnfStateChangeNotification [0x76F31B69+1081]
RtlSubscribeWnfStateChangeNotification [0x76F31B34+1028]

Could not open chrome 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.

binman::list_versions("chromever")的输出

> library(binman)
> list_versions("chromedriver")
$win32
[1] "100.0.4896.20" "100.0.4896.60" "101.0.4951.15" "101.0.4951.41" "102.0.5005.27"
[6] "102.0.5005.61" "103.0.5060.24" "103.0.5060.53" "104.0.5112.20" "104.0.5112.29"
[11] "106.0.5249.61" "107.0.5304.18" "107.0.5304.62" "108.0.5359.22" "108.0.5359.71"
[16] "109.0.5414.25" "109.0.5414.74" "110.0.5481.30" "96.0.4664.45"  "97.0.4692.20" 
[21] "97.0.4692.36"  "97.0.4692.71"  "98.0.4758.48"  "98.0.4758.80"  "99.0.4844.17" 
[26] "99.0.4844.35"  "99.0.4844.51" 

但是我的CHROME版本是:

Chrome is up to date
Version 109.0.5414.75 (Official Build) (64-bit)

selenium的输出(retcommand = T, chromever = "109.0.5414.25")

> selenium(retcommand = T,chromever = "109.0.5414.25")
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] "C:\PROGRA~1\COMMON~1\Oracle\Java\javapath\java.exe c("-Dwebdriver.chrome.driver=\"C:\\Users\\Administrator\\AppData\\Local\\binman\\binman_chromedriver\\win32\\109.0.5414.25/chromedriver.exe\"", "-Dwebdriver.chrome.driver=\"C:\\Users\\Administrator\\AppData\\Local\\binman\\binman_chromedriver\\win32\\109.0.5414.25/LICENSE.chromedriver\"") -Dwebdriver.gecko.driver="C:\Users\Administrator\AppData\Local\binman\binman_geckodriver\win64\0.32.0/geckodriver.exe" -Dphantomjs.binary.path="C:\Users\Administrator\AppData\Local\binman\binman_phantomjs\windows\2.1.1/phantomjs-2.1.1-windows/bin/phantomjs.exe" -jar "C:\Users\Administrator\AppData\Local\binman\binman_seleniumserver\generic\4.0.0-alpha-2/selenium-server-standalone-4.0.0-alpha-2.jar" -port 4567

UPDATE:通过确保删除正确chromever的LICENSE文件,问题得到了解决。在这种情况下,原始发布者删除了许可证。Chromever .

binman/wdman将为每个驱动程序的每个版本下载并创建一个新文件夹。这意味着如果您指定要使用的chromedriver版本,则只会遇到此问题一次。另一方面,默认的行为为binman/wdman采取最新的chromever将意味着一个新的chrome驱动程序的发布可能会破坏你的代码,即使你不使用chrome浏览器在RSelenium

运行selenium(retcommand = T)将告诉您RSelenium如何试图找到您的chromedriver。您可以查看输出以查找chromedriver的文件路径。要寻找的最大标志是R样式"c()"retcommand输出中的向量。如果发生这种情况,您必须删除许可证。chromedriver文件

来自AKshayKulkarni的例子

library(wdman)
selenium(retcommand = T,chromever = '109.0.5414.25')

注意java.exe之后的R向量以">c()开头";这意味着许可证。该文件夹中的Chromedriver需要删除。

[1] "C:\PROGRA~1\COMMON~1\Oracle\Java\javapath\java.exe c("-Dwebdriver.chrome.driver=\"C:\\Users\\Administrator\\AppData\\Local\\binman\\binman_chromedriver\\win32\\109.0.5414.25/chromedriver.exe\"", "-Dwebdriver.chrome.driver=\"C:\\Users\\Administrator\\AppData\\Local\\binman\\binman_chromedriver\\win32\\109.0.5414.25/LICENSE.chromedriver\"") -Dwebdriver.gecko.driver="C:\Users\Administrator\AppData\Local\binman\binman_geckodriver\win64\0.32.0/geckodriver.exe" -Dphantomjs.binary.path="C:\Users\Administrator\AppData\Local\binman\binman_phantomjs\windows\2.1.1/phantomjs-2.1.1-windows/bin/phantomjs.exe" -jar "C:\Users\Administrator\AppData\Local\binman\binman_seleniumserver\generic\4.0.0-alpha-2/selenium-server-standalone-4.0.0-alpha-2.jar" -port 4567

原始回答:

library(wdman)
selenium(retcommand = T)

并发布结果?