如何避免“保护模式"出现问题?在 Selenium 中使用 IEDriverServer? [英] How do I avoid issues with "Protected Mode" using IEDriverServer in Selenium?

查看:29
本文介绍了如何避免“保护模式"出现问题?在 Selenium 中使用 IEDriverServer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Internet Explorer(在我的情况下为 8)通过 Jenkins 执行 Selenium 测试.我了解所有站点区域的保护模式"Internet 安全选项需要设置为相同的值(启用或禁用)才能正常工作.

I'm attempting to use Internet Explorer (8 in my case) to execute Selenium tests via Jenkins. I understand that the "Protected Mode" Internet Security Option needs to be set to the same value (enabled or disabled) for all Site Zones in order for this to work.

我已经尝试在浏览器中执行此操作(确保我以在 Jenkins 中执行测试的同一用户身份登录)以及通过本地计算机策略计算机配置"下所有站点区域的 GPO 策略管理模板Windows 组件Internet ExplorerInternet 控制面板安全页面"并在本地计算机策略用户配置管理模板Windows 组件Internet ExplorerInternet 控制面板安全页面"下..

I've tried doing this both in the browser (making sure I'm logged in as the same user that's executing the tests in Jenkins) and via the GPO Policy for all Site Zones under "Local Computer PolicyComputer ConfigurationAdministrative TemplatesWindows ComponentsInternet ExplorerInternet Control PanelSecurity Page" and under "Local Computer PolicyUser ConfigurationAdministrative TemplatesWindows ComponentsInternet ExplorerInternet Control PanelSecurity Page"..

但是,我仍然收到下面列出的错误:

However, I continue to receive the error listed below:

启动 Internet Explorer 时出现意外错误.并非所有区域的保护模式设置都相同.必须将所有区域的启用保护模式设置为相同的值(启用或禁用).

谁能指出我正确的方向来解决这个问题?

Can anyone point me in the right direction in order to resolve this?

推荐答案

(发布我自己问题的答案,以防其他人通过搜索来到这里.)

(Posting the answer to my own question incase anyone else comes to here from a search.)

为了最终解决这个问题,我必须做两件事:

In order to finally get past this problem I had to do two things:

首先,验证计算机配置"和用户配置"的打开保护模式"设置是否完全相同.我认为设置是否正确并不重要启用/禁用,或者是否启用/禁用保护模式,只要它们(计算机配置下的 11 个和用户配置下的 11 个)都相同.

First, verify that your "Turn on Protected Mode" settings are exactly the same for both "Computer Configuration" and "User Configuration". I don't think it actually matters whether the setting is Enabled/Disabled, or whether Protected Mode is Enabled/Disabled, so long as all of them (11 under Computer Configuration and 11 under User Configuration) are identical.

执行此操作的最快方法是使用组策略编辑器来验证是否配置了所有适当的设置.

The quickest way to do this is to use the Group Policy Editor to verify that all of the appropriate settings are configured.

为此,请打开本地组策略编辑器(开始/运行/gpedit.msc)并导航到本地计算机策略计算机配置管理模板所有设置"节点.按设置排序(如果尚未完成)并向下滚动,直到看到一堆打开保护模式"设置.

To do this, open the Local Group Policy Editor (start / run / gpedit.msc) and navigate to the "Local Computer PolicyComputer ConfigurationAdministrative TemplatesAll Settings" node. Sort by Setting (if not already done) and scroll down until you see a bunch of "Turn on Protected Mode" settings.

将它们中的每一个配置为相同的值.在我的情况下,我最初将这些都设置为启用并禁用保护模式,但是一旦我最终发现注册表更改(见下文),我返回并将所有内容设置为未配置",就像原来一样,我的解决方案仍然工作.重点是让它们完全一样.

Configure each of these to be the same value. In my case I had originally set these all to be Enabled and Protected Mode Disabled, but once I finally found the registry change (see below), I went back in and set everything to "Not Configured" like it was originally and my solution still worked. The main point is to make them all exactly the same.

然后对本地计算机策略用户配置管理模板所有设置"节点重复此过程.

Then repeat this process for the "Local Computer PolicyUser ConfigurationAdministrative TemplatesAll Settings" node.

完成此操作后,您的所有保护模式设置都应该相同.注意:如果您使用一个用户执行您的测试并使用另一个用户进行系统管理,请在两个用户上完成该过程,以防万一.(我的设置有问题,所以我不确定这是否需要,但不会有什么坏处.)

Once this is done, all of your Protected Mode settings should be the same. NOTE: If you use one user to execute your tests and another for system management, go through the process on both users just incase. (I had issues in my setup so I'm not sure if this is required, but it couldn't hurt.)

其次,调整注册表设置.导航到HKLMSoftwareMicrosoftWindowsCurrentVersionInternet Settingsones".对于每个子项 (0,1,2,3,4),找到名为2500"的 DWORD.如果它不存在,请创建它.同样,将所有 5 个区域的值设置为相同.我使用了0",即已启用.我相信3"已禁用.

Second, adjust your registry settings. Navigate to "HKLMSoftwareMicrosoftWindowsCurrentVersionInternet Settingsones". For every sub-key (0,1,2,3,4), locate the DWORD named "2500". If it doesn't exist, create it. Again, set the value to be identical for all 5 Zones. I used '0', which is Enabled. I believe '3' is Disabled.

为正在使用 IEDriverServer.exe 的用户重复此过程以处理HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settingsones".

Repeat this process for "HKCUSoftwareMicrosoftWindowsCurrentVersionInternet Settingsones" for the user that is using IEDriverServer.exe.

更新注册表后,重新启动计算机.

Once you've updated the registry, reboot your machine.

在尝试手动或通过 GPO 调整设置数小时后,按照这两个步骤解决了我的问题.其他人似乎在这两种方法上都取得了成功,但使用注册表编辑是在我的环境中唯一有效的方法(在两个不同的 Jenkins slave 上复制(和修复)).

Following these two steps resolved the problem for me after many hours of trying to adjust the settings manually or via the GPO. Other people seem to have had success with either method, but using the registry edits was the only thing that worked in my environment (replicated (and fixed) on two different Jenkins slaves).

注意:我正在使用 Jenkins 的命名用户帐户进行 IEDriverServer 操作.如果您以本地系统"用户身份执行测试,您可能需要查看 this answer进一步的说明/故障排除.

NOTE: I'm doing the IEDriverServer manipulation with a named user account for Jenkins. If you're executing your tests as the "Local System" user, you may want to take a look at this answer for further instructions/trouble-shooting.

这篇关于如何避免“保护模式"出现问题?在 Selenium 中使用 IEDriverServer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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