Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem running watir-webdriver on Windows 7 with IE9

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?

like image 560
Alastair Montgomery Avatar asked Jun 23 '11 12:06

Alastair Montgomery


2 Answers

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
like image 109
Mike Kwan Avatar answered Sep 23 '22 06:09

Mike Kwan


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
like image 3
Shiv Avatar answered Sep 20 '22 06:09

Shiv