Internet Explorer保护模式错误

lbr*_*own 9 .net selenium nunit webdriver

我在Visual Studio中的代码使用的是selenium webdriver 2.24.0.我正在使用的测试框架是Nunit.我的代码工作得很好(加载差异浏览器,驱动网站),直到2.24.0版本发布.

我将新的IE独立服务器添加到我的项目中.

现在每当我运行我的代码时,NUnit都会遇到此错误消息.

 FirstSeleniumTest.SeleniumTest.TestGoogle:
SetUp : System.InvalidOperationException : 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. (NoSuchDriver)
TearDown : System.NullReferenceException : Object reference not set to an instance of an object.
Run Code Online (Sandbox Code Playgroud)

然后弹出命令提示符.

Started InternetExplorerDriver server (64-bit)
2.24.0.0
Listening on port 50329
Run Code Online (Sandbox Code Playgroud)

我在IE上禁用了保护模式.仍然没有运气.

如何才能将代码恢复到正确的webdriving状态?

Ale*_*nov 16

您应该确保为所有 4个安全区域(Int​​ernet,本地Intranet,受信任的站点,受限制的站点)启用或禁用保护模式.换句话说,所有安全区域的设置值应该相同.


JHi*_*son 16

只是为了添加已经正确的答案,如果设置所有值都不是一个选项,(需要安全性禁用是某些区域,但希望在其他区域中启用安全性),您还可以使用包含的重载初始化驱动程序InternetExplorerOptions,并且使用

new InternetExplorerOptions() { IntroduceInstabilityByIgnoringProtectedModeSettings = true}
Run Code Online (Sandbox Code Playgroud)


Sha*_*ama 6

您需要将每个区域的保护模式设置设置为相同的值.阅读:http://code.google.com/p/selenium/wiki/InternetExplorerDriver#Required_Configuration