Internet Explorer Protective Mode Setting and Zoom Levels

Internet Explorer Protective mode setting and Zoom levels

While working with Selenium 3.x, IEDriverServer 3.x and Internet Explorer you can't ignore Zoom Levels and Protective Mode settings.

If you look into the Required Configuration of Internet Explorer Driver the following points are clearly mentioned :

Protected Mode

On Internet Explorer 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 you have to choose "Internet Options" from the "Tools" menu and then click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled Enable Protected Mode.

ProtectedModeSettings

@JimEvans in his article You're Doing It Wrong: IE Protected Mode and WebDriver clearly mentions :

Using the capability doesn't solve the underlying problem though. If a Protected Mode boundary is crossed, very unexpected behavior including hangs, element location not working, and clicks not being propagated, could result. To help warn people of this potential problem, the capability was given big scary-sounding names like INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS in Java and IntroduceInstabilityByIgnoringProtectedModeSettings in .NET. We really thought that telling the user that using this setting would introduce potential badness in their code would discourage its use, but it turned out not to be so.

Browser Zoom Level

The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.



Solution

As per the Required Configuration of Internet Explorer Driver :

  • Set/Unset the Protected Mode settings to the same level for all the Zones.
  • Set the Browser Zoom Level to 100%

How to handle IE browser with Zoom other than 100%?

As per the Required Configuration for InternetExplorerDriver:

The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.

Additionally,

For Windows 10, you also need to set "Change the size of text, apps, and other items" to 100% in display settings.

So while using InternetExplorerDriver and InternetExplorer you need to configure the following:

cap.setCapability("ignoreZoomSetting", true);
cap.setCapability("requireWindowFocus", false);
cap.setCapability("nativeEvents", false);

You can find a couple of relevant discussions in:

  • How to ignore zoom setting
  • Selenium InternetExplorerDriver doesn't get focus on the window

So setting these capabilities are part of best practices and incase with these configurations the browser initialization is having issue that needs detailed analysis.


However, at this point it's worth to mention that:

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".

You can find a couple of relevant discussions in:

  • Internet Explorer Protective mode setting and Zoom levels

tl;dr

A couple of related discussions:

  • Internet Explorer 11 getting stuck randomly while executing tests through IEDriverServer and Selenium
  • How does the registry entry HKEY_LOCAL_MACHINE\…\FEATURE_BFCACHE for InternetExplorerDriver solves the Internet Explorer 11 issue?

Internet Explorer protected mode error

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.

Selenium performance with InternetExplorerDriver and IE11

To start with, Selenium v3.8.0 of 2017-11-30 is more then 2 years older. Even the error trace logs would be difficult to debug. So as per best practices you may like to:

  • First of all, the fact that ...64-bit IEDriverServer executable populate the input fields with the character sequence very slowly as compared to 32-bit IEDriverServer executable.... is a known issue.

You can find a detailed discussion in IEDriverServer sends text very slowly using Selenium to the search field

  • Ensure the Internet Explorer Protective mode setting are properly configured.
  • Ensure the Zoom level is properly configured.
  • Ensure ignoreProtectedModeSettings is properly confugured.
  • Ensure setting up selenium to work with internet explorer.
  • Ensure FEATURE_BFCACHE is properly confugured.
  • Upgrade Selenium to current levels Version 3.141.59.
  • Upgrade IEDriverServer to latest IEDriverServer v3.150.1 level.

    Note: As per best practices as Selenium Client and InternetExplorerDriver are released in sync and you must try to use both the binaries from the same major release.

  • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
  • Execute your @Test.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

tl;dr

A couple of references:

  • Internet Explorer 11 getting stuck randomly while executing tests through IEDriverServer and Selenium
  • HTTP Status: '500' -> incorrect JSON status mapping for 'timeout' (408 expected) while clicking element with IEDriverServer Selenium and Java

Not able to launch IE browser using Selenium2 (Webdriver) with Java

It needs to set same Security level in all zones. To do that follow the steps below:

  1. Open IE
  2. Go to Tools -> Internet Options -> Security
  3. Set all zones (Internet, Local intranet, Trusted sites, Restricted sites) to the same protected mode, enabled or disabled should not matter.

Finally, set Zoom level to 100% by right clicking on the gear located at the top right corner and enabling the status-bar.
Default zoom level is now displayed at the lower right.



Related Topics



Leave a reply



Submit