Selenium-webdriver系列教程(16)————为firefox设置代理
2014-11-06 11:26
645 查看
下面的代码可以帮助你实现firefox测试运行时代理配置的功能。大概的思路是通过设置profile对象来进行配置。
[ruby]
view plaincopyprint?
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
[ruby]
view plaincopyprint?
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
相关文章推荐
- Selenium-webdriver系列教程(16)————为firefox设置代理
- Selenium-webdriver系列教程(14)————为firefox设置代理
- Selenium-webdriver系列教程(17)————为firefox设置下载文件的保存目录
- Selenium-webdriver系列教程(15)————使用已存在的profile启动firefox
- Selenium-webdriver系列教程(13)————使用已存在的profile启动firefox
- Selenium-webdriver系列教程(12)————如何在启动firefox时加载扩展
- Selenium-webdriver系列教程(14)————如何在启动firefox时加载扩展
- Selenium-webdriver系列教程(11)————使用jquery辅助进行测试
- Selenium-webdriver系列教程(3)———如何执行一段js脚本
- Selenium-webdriver系列教程(5)————如何定位frame中的元素
- Selenium-webdriver系列教程
- Selenium-webdriver系列教程(四)————如何定位测试元素
- Selenium-webdriver系列教程(7)————如何处理alert和confirm
- Selenium-webdriver系列教程(12)————fire event的替代方案
- Selenium-Webdriver系列教程(2)————浏览器的简单操作
- Selenium-webdriver系列教程(3)————如何执行一段js脚本
- Selenium-Webdriver系列教程(2)———浏览器的简单操作
- Selenium-webdriver系列教程(5)———如何定位frame中的元素