Monday, October 17, 2011

Using the InternetExplorerDriver for WebDriver

Are you getting this error when trying to use the InternetExplorerDriver for WebDriver (Selenium 2.0)?


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

Don't worry, it's easier to fix than it sounds: Simply go into your Internet Options of Internet Explorer, select the Security tab, and all four zones to have the same Protected Mode value (either all on or all off). That's it!

Sample Code

using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
namespace WebDriverTests
    public abstract class WebDriverTestBase
        public IWebDriver WebDriver { get; set; }
        public void TestFixtureSetUp()
            WebDriver = new InternetExplorerDriver();
        public void TestFixtureTearDown()
            if (WebDriver != null)
        public void SetUp()
            WebDriver.Url = "about:blank";
    public class GoogleTests : WebDriverTestBase
        public void SearchForTom()
            WebDriver.Url = "";
            IWebElement searchBox = WebDriver
            searchBox.SendKeys("Tom DuPont");
            IWebElement firstResult = WebDriver
                .FindElement(By.CssSelector("#search cite"));
            Assert.AreEqual("", firstResult.Text);
Shout it


1 comment:

  1. We are a team of business logo designer designers offering high quality business logo design services and brand solutions for start-ups, small and medium entrepreneurs. With many happy customers worldwide and 5+ years in the industry, we are a pioneering logo design company with one of the highest customer satisfaction ratings. Our brand solutions start at prices as low as $ 40, making us one of the most affordable custom logo design companies, ideal for beginners and start-ups. Our brand solutions include custom logo design, stationery design, poster design, product label design, product packaging design, banner advertising design, logo vector services and logo repairs. We also provide website design services for businesses looking to build an online presence and for ecommerce businesses with powerful content management features and capabilities.


Real Time Web Analytics