Problem running watir-webdriver on Windows 7 with IE9

杀马特。学长 韩版系。学妹 提交于 2019-12-10 14:14:07

问题


I'm trying to use watir-webdriver with IE9 on 64bit Windows 7. When I try to open a new browser I am getting the following error message, any ideas on a solution?

C:\watir>irb
irb(main):001:0> require "rubygems"
=> true
irb(main):002:0> require "watir-webdriver"
=> true
irb(main):003:0> browser = Watir::Browser.new(:ie)
Selenium::WebDriver::Error::NoSuchDriverError: Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones.

I can use watir-webdriver on the same machine okay with Firefox 4, so I'm guess either its and IE9 issue?


回答1:


Did you try disabling protected mode as the error message tells you ?

Tools >> Options >> Security >> Untick 'Enable Protected Mode'

This thread on selenium-developers group is relevant to the restrictions with protected mode: http://groups.google.com/group/selenium-developers/browse_thread/thread/4dd6330f97bd2312/3e904642ac3dac6?q

Also relevant a link to the Watir FAQ.

Try one of these:

  • Add your defaut homepage (or 'About:Blank' if you start with a blank page) to the same security group (e.g. 'intranet' or ''trusted sites') as the site you are testing; or
  • Turn off Internet Explorer Protected Mode; or
  • Change your ruby permissions to "run as administrator"; or
  • Disable User Access Control



回答2:


I had same issue, but I have fixed it within the Automation script by setting IE Capabilities. We can change protected mode settings within the script, before launching the browser. You can try the below code:

caps = Selenium::WebDriver::Remote::Capabilities.ie(:ignoreProtectedModeSettings => true)
driver = Watir::Browser.new  :ie, :desired_capabilities => caps


来源:https://stackoverflow.com/questions/6454048/problem-running-watir-webdriver-on-windows-7-with-ie9

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!