我正在尝试使用 RSelenium。这是我正在做的事情:
library(RSelenium)
driver<- rsDriver(browser=c("chrome"))
remDr <- driver[["client"]]
remDr$open()
返回
$id
[1] 不适用
remDr$navigate("http://www.google.com")
(返回 NULL)
remDr$getCurrentUrl()
返回空列表
我认为这个令人失望的结果可能是因为我支持公司代理。
如何将http代理传递给selenium浏览器?
谢谢
最佳答案
您需要使用extraCapability
并使用相同的方式设置代理
cprof <- list(chromeOptions =
list(args = list("--proxy-server=http://118.69.61.212:53281")))
driver<- rsDriver(browser=c("chrome"), extraCapabilities = cprof)
driver$client$navigate("http://ipinfo.io")
您可以看到 chrome 现在使用代理配置
关于RSelenium 背后的代理,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50388282/