无法使用Selenium WebDriver和Java打开IE11驱动程序实例 [英] Unable to open IE11 driver instance using Selenium WebDriver with Java

查看:363
本文介绍了无法使用Selenium WebDriver和Java打开IE11驱动程序实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    System.setProperty("webdriver.ie.driver","C:\\Users\\IEDriverServer_Win32_2.45.0\\IEDriverServer.exe");

    WebDriver driver = new InternetExplorerDriver();

    driver.get("http://xxx");

执行上述代码时显示错误:

Shows error while executing above code:

线程main中的异常org.openqa.selenium.remote.SessionNotFoundException:启动Internet Explorer时出现意外错误。保护模式设置对于所有区域都不相同。必须将启用保护模式设置为所有区域的相同值(启用或禁用)。 (警告:服务器未提供任何堆栈跟踪信息)
命令持续时间或超时:1.33秒

Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: 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. (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.33 seconds

有人可以建议解决此问题吗?

Can anyone suggest to resolve this issue?

推荐答案

如果您在代理之后没有访问条款来更改保护模式设置,那么请使用此功能

If u are behind proxy with no access provision to change the protected mode settings then use this capabilities

DesiredCapabilities cap = DesiredCapabilities.internetExplorer();
        cap.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);

这会引入一些瑕疵

这篇关于无法使用Selenium WebDriver和Java打开IE11驱动程序实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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