Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When using Selenium Webdriver, I get the following error using the InternetExplorerDriver - "Unexpected error launching Internet Explorer...."

Tags:

I'm trying to instantiate an InternetExplorerDriver in C#, and every time I do I get the following error message:

System.InvalidOperationException : Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones. (NoSuchDriver)

Now I'm not sure how to sort this out, but the line of code that triggers the error in question is:

IWebDriver driver = new InternetExplorerDriver(); 

The documentation for InternetExplorerDriver suggests that I can pass in an ICapabilities object in an overloaded constructor, but that only has the properties BrowserName, IsJavaScriptEnabled, Platform and Version. None of these seem to suggest that they can solve the issue.

Is there something I need to do within the implementation to sort this out? Or do I have to modify some settings within IE9 itself?

like image 544
Yorkie_Henno Avatar asked Aug 16 '11 14:08

Yorkie_Henno


1 Answers

For reference, if your wish to override the security options here's the c# code:

using NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.IE;  namespace SeleniumTests {     [TestFixture]     public class Test     {        private IWebDriver driver;         [SetUp]        public void Setup()        {           var options = new InternetExplorerOptions();           options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;           driver = new InternetExplorerDriver(options);        }     } } 

Update:
My previous answer used an older version of Selenium 2.0, I've now updated the code to work against Selenium DotNet-2.21.0 and included the correct namespaces.

like image 139
Ralph Willgoss Avatar answered Sep 17 '22 12:09

Ralph Willgoss