Selenium-webdriver系列教程(15)————使用已存在的profile启动firefox
2011-10-29 09:46
597 查看
关于firefox的profile,这里不想叙述太多,只说一点,那就是通过profile我们可以去修改测试运行时firefox的具体配置,对于firefox的自动化测试来说是必须掌握的一个知识点。
使用selenium-webdirver操作profile的代码如下:
也可以在代码中动态的更改已存在profile的配置
使用selenium-webdirver操作profile的代码如下:
# 使用已存在profile进行测试 # 由于profile里保存有cookie等信息 # 因此可以通过该技术来保持用户的登录态 driver = Selenium::WebDriver.for(:firefox, :profile => "my-existing-profile")
也可以在代码中动态的更改已存在profile的配置
default_profile = Selenium::WebDriver::Firefox::Profile.from_name "default" # 启用本地事件 default_profile.native_events = true driver = Selenium::WebDriver.for(:firefox, :profile => default_profile)
相关文章推荐
- Selenium-webdriver系列教程(13)————使用已存在的profile启动firefox
- Selenium-webdriver系列教程(14)————如何在启动firefox时加载扩展
- Selenium-webdriver系列教程(12)————如何在启动firefox时加载扩展
- Selenium-webdriver系列教程(14)————为firefox设置代理
- Selenium-webdriver系列教程(十)————使用jquery辅助进行测试
- Selenium-webdriver系列教程(十)————使用jquery辅助进行测试
- Selenium-webdriver系列教程(16)————为firefox设置代理
- selenium之python自动化测试系列:使用chrome或firefox的已存在的cookie访问网站
- selenium之python自动化测试系列:使用chrome或firefox的已存在的cookie访问网站
- Selenium-webdriver系列教程(11)————使用jquery辅助进行测试
- Selenium-webdriver系列教程(17)————为firefox设置下载文件的保存目录
- Selenium-webdriver系列教程(8)————使用Page Object设计模式
- Selenium-webdriver系列教程(16)————为firefox设置代理
- selenium之python自动化测试系列:使用chrome或firefox的已存在的cookie访问网站
- Selenium-webdriver系列教程(8)———使用Page Object设计模式
- Selenium-webdriver系列教程(15)————万能的截图
- Selenium-webdriver系列教程(3)————如何执行一段js脚本
- ruby/python/java全覆盖的Selenium-Webdriver系列教程(2)————浏览器的简单操作
- Selenium-webdriver系列教程(四)————如何定位测试元素
- Struts1.x系列教程(15):使用DownloadAction类统计文件下载次数