加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ruby – 在selenium webdriver中使用带有phantomjs的代理

发布时间:2020-12-17 01:50:25 所属栏目:百科 来源:网络整理
导读:我正在尝试使用PhantomJS 1.9.1在selenium webdriver(2.25)的 ruby(1.8.7)脚本中配置代理. 我在Firefox上看到了一些例子,我用这个浏览器成功地完成了它.我用过这段代码: profile = Selenium::WebDriver::Firefox::Profile.new profile.proxy = Selenium::We
我正在尝试使用PhantomJS 1.9.1在selenium webdriver(2.25)的 ruby(1.8.7)脚本中配置代理.

我在Firefox上看到了一些例子,我用这个浏览器成功地完成了它.我用过这段代码:

profile = Selenium::WebDriver::Firefox::Profile.new
    profile.proxy = Selenium::WebDriver::Proxy.new :ssl => 'chronos.landebitel.local:3128'
    $browser = Watir::Browser.new :firefox,:profile => profile

但我找不到任何phantomjs的例子.我搜索并尝试了许多解决方案,但都没有效果.

有人可以举个例子来帮助我吗?

解决方法

尝试:

Watir::Browser.new( :phantomjs,args: '--proxy=localhost:8181'
)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读