Selenium-webdriver系列教程(14)————为firefox设置代理

下面的代码可以帮助你实现firefox测试运行时代理配置的功能。大概的思路是通过设置profile对象来进行配置。

profile = Selenium::WebDriver::Firefox::Profile.new
# 新建了url为proxy.org,端口为8080的htpp代理
proxy = Selenium::WebDriver::Proxy.new(:http => "proxy.org:8080")
profile.proxy = proxy

driver = Selenium::WebDriver.for :firefox, :profile => profile

 

posted on 2012-09-05 22:03  tim_sheng  阅读(490)  评论(0编辑  收藏  举报

导航