Error :: SessionNotCreatedError:启动Internet Explorer发生意外错误

问题描述 投票:0回答:1

无法使用我的脚本启动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"复选框均被禁用enter image description here

此外,尝试用所需的功能覆盖它,这是代码,但没有成功:

caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer(
                     :ignoreProtectedModeSettings => true,
                     :javascriptEnabled => true,
                 )
Watir::Browser.new :ie, http_client: client,:desired_capabilities => caps

我在Ruby和Watir中使用Cucumber,而浏览器是Internet Explorer 11。

请为此提供一些解决方法。

ruby automation cucumber internet-explorer-11 watir
1个回答
0
投票

经过不断研究,问题得以解决,

  1. Stackoverflow和Github的大多数答案都显示了从Internet Options更改设置,但是由于权限限制,这些设置对我来说不起作用
  2. [来自LinkedIn https://www.linkedin.com/pulse/automation-using-internet-explorer-11-pritam-maske的博客文章之一。建议修改特定于Internet Explorer的注册表,但是由于权限限制,我也无法对其进行编辑。
  3. [从注册表修改中获取要点,然后我找到了一种通过PowerShell script对其进行编辑的方法,并且找到了几种从Microsoft Power Shell脚本存储库重置Internet Explorer首选项的解决方案How to reset all Internet Explorer settings for a different user profile?
  4. 有了这一步成功,但是主要问题仍然相同,即我的IE 11没有启动,然后搜索了“对所有区域启用保护模式”,并且很少有相关说明,]

    a。 Powershell – IE zones Protected Mode state

    b。 IE Browser - Powershell script to add a site to trusted sites list, disable protected mode & make all zones security level low

    最后,在Powershell脚本中进行了调整之后,它可以工作了,而我的脚本在IE浏览器中也可以正常工作。

© www.soinside.com 2019 - 2024. All rights reserved.