Selenium-webdriver系列教程(15)————使用已存在的profile启动firefox_Ruby_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > Ruby > Selenium-webdriver系列教程(15)————使用已存在的profile启动firefox

Selenium-webdriver系列教程(15)————使用已存在的profile启动firefox

 2012/3/20 13:58:38  nbkhic  程序员俱乐部  我要评论(0)
  • 摘要:关于firefox的profile,这里不想叙述太多,只说一点,那就是通过profile我们可以去修改测试运行时firefox的具体配置,对于firefox的自动化测试来说是必须掌握的一个知识点。使用selenium-webdirver操作profile的代码如下:#使用已存在profile进行测试#由于profile里保存有cookie等信息#因此可以通过该技术来保持用户的登录态driver=Selenium::WebDriver.for(:firefox,:profile=>"my
  • 标签:file Web 使用 FireFox 教程 启动
关于firefox的profile,这里不想叙述太多,只说一点,那就是通过profile我们可以去修改测试运行时firefox的具体配置,对于firefox的自动化测试来说是必须掌握的一个知识点。

使用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)
发表评论
用户名: 匿名