簡體   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