Monday, January 16, 2012

Internet explorer is not starting using selenium webdriver. Message : Protected Mode must be set to the same value

If internet explorer is not starting using selenium webdriver and shows the error message says that "Unexpected error launching Internet Explorer. Protected Mode must be set to the same value (enabled or disabled) for all zones. "

Create a desired capabilities instance and use it while creating the internet explorer driver. This is what the configuration done for this error as per the docs in selenium wiki. selenium help wiki link - http://code.google.com/p/selenium/wiki/InternetExplorerDriver
Required Configuration

    On IE 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings, choose "Internet Options..." from the Tools menu, and click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled "Enable Protected Mode".
    The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.

Even if it does not start the browser, create a desired capabilities instance and set ingnore flakiness boolean to true. Here is the code for code for ignoring the the protected mode security for all zones.
   
    DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
 capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
        WebDriver driver = new InternetExplorerDriver(capabilities);

9 comments:

  1. Hi,

    INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS

    what it does

    ReplyDelete
  2. It is a field in "InternetExplorerDriver" class. As the name of the field says Setting this field to true will make the browser ignore security domains.

    ReplyDelete
  3. Hi,
    Is there a way to set IE to 100% zoom through selenium web driver?
    Thanks,
    Rakshith

    ReplyDelete
  4. As far as i know you can get/set the browser zoom level using javascript. Execute following javascript using webdriver. Use this code snippet to find zoom level IE 7

    function getZoom() {
    var body = document.body,r = body.getBoundingClientRect(); return (r.left-r.right)/body.offsetWidth;
    }


    Also you can set zoom level to 100% using javascript.


    Check right javascript code for other browsers from here -

    http://stackoverflow.com/questions/1713771/how-to-detect-page-zoom-level-in-all-modern-browsers

    ReplyDelete
  5. You can set zoom to 100%
    Just refer this answer
    http://stackoverflow.com/questions/11498445/how-to-press-ctrl0-using-selenium-web-driver/11499416#comment15195086_11499416

    ReplyDelete
  6. interesting blog. It would be great if you can provide more details about it. Thanks you.

    Microsoft Internet Explorer Support

    ReplyDelete
  7. The RMB TO USD Converter Is Updated Every 15 Minutes. You Can Set It To Alert You Whenever The Rate Changes.

    ReplyDelete