Internet Explorer保护模式设置和缩放级别 [英] Internet Explorer Protective mode setting and Zoom levels

查看:341
本文介绍了Internet Explorer保护模式设置和缩放级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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"
    };
    }
}

我正在尝试使用以上代码在运行Selenium脚本时忽略缩放级别和保护模式设置,但是该脚本在构建解决方案时显示错误.不知道我要去哪里错了.

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.

推荐答案

使用 Selenium 3.x IEDriverServer 3.x Internet Explorer ,您不能忽略缩放级别保护模式设置.

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

如果您查看 必需的配置 Internet Explorer驱动程序 明确提到了以下重点:

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

在Windows Vista或Windows 7的Internet Explorer 7或更高版本上,必须将每个区域的保护模式设置设为相同的值.该值可以打开或关闭,只要每个区域都相同即可.要设置保护模式设置,您必须选择"Internet选项"从工具"菜单,然后点击安全标签.对于每个区域,选项卡底部都会有一个标记为启用保护模式的复选框.

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在他的文章 您做错了:IE保护模式和WebDriver 明确提到:

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

使用该功能并不能解决根本问题.如果越过保护模式边界,可能会导致非常意外的行为,包括挂起,元素位置不起作用以及单击不传播.为了警告人们这个潜在的问题,该功能使用了一些吓人的名字,如 Java 中的INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS .NET 中的IntroduceInstabilityByIgnoringProtectedModeSettings.我们确实以为告诉用户使用此设置会在他们的代码中引入潜在的缺陷,因此会阻止它的使用,但事实并非如此.

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.

浏览器缩放级别

浏览器缩放级别必须设置为100%,以便可以将本机鼠标事件设置为正确的坐标.

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.

按照 必需的配置 Internet Explorer驱动程序 :

  • 将所有区域保护模式设置/取消设置为相同级别.
  • 浏览器缩放级别设置为 100%
  • Set/Unset the Protected Mode settings to the same level for all the Zones.
  • Set the Browser Zoom Level to 100%

这篇关于Internet Explorer保护模式设置和缩放级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆