Internet Explorer Protective mode setting and Zoom levels
Asked Answered
W

1

2
using System;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium;

namespace CSharpAutomationFramework.Tests
{
        public class BrowserSource
    {
        var options = new InternetExplorerOptions();
        options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
            public bool IgnoreZoomLevel { get; set; }
        public bool IntroduceInstabilityByIgnoringProtectedModeSettings { get; set; }

        InternetExplorerDriver protectivemode = new InternetExplorerDriver(options);
        InternetExplorerOptions options = new InternetExplorerOptions();
        options.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
        InternetExplorerDriver zoom = new InternetExplorerDriver(zoomoptions);
        InternetExplorerOptions zoomoptions = new InternetExplorerOptions();
        options.IgnoreZoomLevel = true;

        static string[] Browsers = {
            "ie"
    };
    }
}

I am trying to use the above code to ignore zoom levels and Protective mode settings while running my selenium script but the script is displaying errors on building the solution. Not sure where i am going wrong.

Winters answered 16/4, 2018 at 5:59 Comment(0)
H
2

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%
Heger answered 16/4, 2018 at 7:0 Comment(1)
Ok Thanks for the logical Explanation behind it.Winters

© 2022 - 2024 — McMap. All rights reserved.