Reputation: 675
My code in Visual studio is using selenium webdriver 2.24.0. My testing framework I'm using is Nunit. My code worked just fine(loading diff. browsers, driving the websites) until version 2.24.0 was released.
I added the new IE standalone server to my project.
Now whenever I run my code NUnit encounters this error message.
FirstSeleniumTest.SeleniumTest.TestGoogle:
SetUp : System.InvalidOperationException : Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (NoSuchDriver)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Then Command prompt pops up with this.
Started InternetExplorerDriver server (64-bit)
2.24.0.0
Listening on port 50329
I disabled protected mode on my IE. Still no luck.
How can I get my code back to proper webdriving?
Upvotes: 8
Views: 12165
Reputation: 896
I Agree with what Alexander is saying but what if your firm does not allow you to make any changes to IE settings.
The following worked for me :
File file = new File("M:\\dev\\ria\\iedriver\\2.42.0\\install\\exec\\IEDriverServer.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
WebDriver driver = new InternetExplorerDriver(caps);
driver.get("http://www.google.com");
Upvotes: 2
Reputation: 1522
Just to add to the already correct answers, if setting all values the same is not an option, (Need security disabled is some zones, but want to keep security enabled in others) you can also initialize your driver with the overload that includes InternetExplorerOptions
, and use
new InternetExplorerOptions() { IntroduceInstabilityByIgnoringProtectedModeSettings = true}
Upvotes: 15
Reputation: 579
You should ensure, that protected mode is either enabled or disabled for all 4 security zones (Internet, Local intranet, Trusted sites, Restricted sites). In other words, the setting value should be the same for all security zones.
Upvotes: 15
Reputation:
You need to set the Protected Mode settings for each zone to be the same value. Read: http://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration
Upvotes: 4