【问题标题】:Failed to connect to localhost port 3918: Connection refused(R Rselenium)无法连接到本地主机端口 3918:连接被拒绝(R Rselenium)
【发布时间】:2023-01-26 07:57:15
【问题描述】:

寻求有关如何解决主题行错误的帮助。

这里引用的许多以前的帖子和解决方案已经被审查/尝试过。

过去,同样的错误已通过更新 R、Rstudio 得到解决。

该代码已使用多年,最近几天前:

library(chromote) # to get the chrome version
library(netstat) # to dynamically change ports
library(RSelenium) # to run Selenium

b <- ChromoteSession$new()
browser_version <- b$Browser$getVersion()$product
browser_version<-gsub(".*/","",browser_version)

realVersion <- substr(browser_version,1,3)

chromeVersions <- binman::list_versions("chromedriver")
chromeVersions <- chromeVersions$win32

realChromeVer <-chromeVersions[which(substr(chromeVersions,1,3)==realVersion)]

driver <- rsDriver(browser = 'chrome', port = free_port(random = TRUE), chromever = realChromeVer[1], verbose = F)
remdr <- driver[['client']]
remdr$maxWindowSize()

错误信息:

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

有没有办法让 rsDriver 运行它?
如果有人可以帮助我解决这个问题,我将非常感激。

【问题讨论】:

    标签: r rselenium netstat rsdriver


    【解决方案1】:

    https://stackoverflow.com/a/75176907/15363011https://github.com/ropensci/RSelenium/issues/264查看答案

    问题很可能是最新的 Chrome 版本 (109+) 正在创建一个阻止 wdman::selenium() 运行的错误。您是否尝试删除 RSDriver 设置的 chrome 驱动程序路径中的许可证文件(通过 wdman 包)?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-17
      • 1970-01-01
      • 2023-02-17
      • 2017-12-01
      • 2022-11-16
      • 2013-06-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多