代理背后的RSelenium [英] RSelenium behind proxy

查看:119
本文介绍了代理背后的RSelenium的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用RSelenium.这是我在做什么:

I am trying to use RSelenium. Here is what I am doing:

library(RSelenium)  
driver<- rsDriver(browser=c("chrome"))
remDr <- driver[["client"]]
remDr$open()

返回
$ id
[1]不适用

returns
$id
[1] NA

remDr$navigate("http://www.google.com")

(返回NULL)

remDr$getCurrentUrl()

返回空列表

我认为这个令人失望的结果可能是因为我落后于公司代理人.

I am thinking this disappointing result might be because I am behind corporate proxy.

如何将http代理传递给硒浏览器?

How can I pass the http proxy to selenium browser?

谢谢

推荐答案

您需要使用extraCapabilities并使用相同的设置代理

You need to use extraCapabilities and set the proxy using the same

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现在使用代理配置

And you can see that chrome now uses the proxy config

这篇关于代理背后的RSelenium的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆