org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launch IE

1.在启动ie浏览器前先加入属性设置一项:

DesiredCapabilities ie = DesiredCapabilities.internetExplorer();
ie.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true); System.setProperty("webdriver.ie.driver", "e:/IEDriverServer.exe");
driver = new InternetExplorerDriver(ie);

  

2.如果加入属性项返回“This is the initial start page for the WebDriver server.” 则说明你浏览器进行了缩放,具体如报错:

Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected error launching Internet Explorer. Browser zoom level was set to 125%. It should be set to 100% (WARNING: The server did not provide any stacktrace information)
解决方案:将IE浏览器缩放比例设置成100%  页面→缩放,选择100%,再次运行即可。

上一篇:selenium 学习笔记 ---新手学习记录(8) 问题总结(java)


下一篇:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ppcloud-common: Compilation failure