Internet Explorer Protective mode setting and Zoom levels

孤人 提交于 2019-11-26 14:51:42

问题


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.


回答1:


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

@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%


来源:https://stackoverflow.com/questions/49850465/internet-explorer-protective-mode-setting-and-zoom-levels

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!