【发布时间】:2020-04-16 13:50:07
【问题描述】:
无法使用我的脚本启动 Internet Explorer 会出现此错误
Selenium::WebDriver::Error::SessionNotCreatedError: Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones.
我进行了很多研究以解决这个问题,发现很少有解决方案 https://stackoverflow.com/a/29453294/1976848,但我无法更改我的 IE 浏览器设置,此处所有区域的 "Enable Protected mode" 复选框均已禁用
另外,尝试使用所需功能覆盖此代码,但未获得任何成功:
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(
:ignoreProtectedModeSettings => true,
:javascriptEnabled => true,
)
Watir::Browser.new :ie, http_client: client,:desired_capabilities => caps
我将 Cucumber 与 Ruby 和 Watir 一起使用,浏览器是 Internet Explorer 11。
请为此提出一些解决方法。
【问题讨论】:
-
可能为其中一个安全区域启用了保护模式。我建议您再次检查所有区域并尝试禁用它。如果问题仍然存在,您可以尝试联系系统管理员帮助您进行修改。
-
问题已解决,首先我尝试通过编辑特定于浏览器选项的注册表来修复它,但我也没有权限。然后我尝试了一种使用脚本修改它的方法,并找到了一个参考“Power Shell”脚本来从这里修改它stackoverflow.com/q/51720030,在对脚本进行一些调整后,它可以工作了:D
-
感谢您分享该问题的解决方案。我建议您将您的解决方案发布为该线程的答案,并尝试在 48 小时后将您自己的答案标记为该问题的可接受答案,当它可以标记时。它可以在未来帮助其他社区成员解决类似的问题。感谢您的理解
-
做到了!谢谢@Deepak-MSFT
-
你也可以尝试接受它作为一个答案,当它可以这样做时。
标签: ruby automation cucumber internet-explorer-11 watir