繁体   English   中英

如何在 RSelenium 中使用 Google Chrome Beta

[英]How to use Google Chrome Beta with RSelenium

根据这个答案https://stackoverflow.com/a/72793082/2554330 ,最新版本的chromedriver中有一些错误已在适用于 Google Chrome Beta 的版本中修复,所以我想试试贝塔。

这个答案https://stackoverflow.com/a/65975577/2554330展示了如何从 Javascript 运行 Google Chrome Beta。 我想从 RSelenium 做同样的事情,但我找不到chrome_options.binary_location的等价物。

使用 RSelenium 时如何指定 Chrome 位置?

尝试以下代码:

cPath <- "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"
ecap <- list(chromeOptions = list("binary" = cPath))
remDr <- remoteDriver(browserName = "chrome", extraCapabilities = ecap)
remDr$open()

请注意, startServer()函数现在已失效。

这些是由RSelenium的作者从此评论中获得的。

试试这个,chromedriver 就在你放置它的任何地方,而 beta 浏览器就在它安装的任何地方。 我已经很久没有使用 r/selenium 了,所以斜线可能是错误的方式

require(RSelenium)
RSelenium::startServer(args = c("-Dwebdriver.chrome.driver=C:\\Users\\me\\Documents\\chromedriver.exe")
            , log = FALSE, invisible = FALSE)

remDr <- remoteDriver(
  browserName = "chrome",
  extraCapabilities = list("chrome.binary" = "C:\\Program Files\\ChromeBeta\\chrome.exe")
)
remDr$open()

head(remDr$sessionInfo)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM