使用Rselenium与firefox和socks5h

时间:2015-02-23 09:27:35

标签: r firefox proxy socks rselenium

我正在使用RSelenium软件包连接到firefox,但我希望通过socks代理来实现。

在Python中,这可以使用webdriver包并设置FirefoxProfile的首选项来实现,例如: profile=webdriver.FirefoxProfile() profile.set_preference('network.proxy.socks', x.x.x.x) profile.set_preference('network.proxy.socks_port', ****) browser=webdriver.Firefox(profile)

但是,我找不到如何尝试将代理设置为socks代理,或者在RSelenium中设置socks端口。我已尝试使用RCurl选项进行设置,如下所示 options(RCurlOptions = list(proxy = "socks5h://x.x.x.x:****")) 但这给了我以下错误信息 Error in function (type, msg, asError = TRUE) : Can't complete SOCKS5 connection to 0.0.0.0:0. (1) 有没有人使用使用R代码的socks代理成功连接到Firefox?

我使用的是RSelenium 1.3.5版本和Firefox版本28.0。

1 个答案:

答案 0 :(得分:1)

未经测试,但以下内容应该有效:

fprof <- makeFirefoxProfile(list(
  "network.proxy.socks" = "squid.home-server"
  , "network.proxy.socks_port" = 3128L
  , "network.proxy.type" = 1L
)
)
remDr <- remoteDriver(extraCapabilities = fprof)
remDr$open()
相关问题