本文介绍了启动Internet Explorer时出现意外错误。 IELaunchURL()使用Selenium 3.13.0返回HRESULT 80070012:IEDriverServer_x64_3.13.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的硒测试用例在Internet Explorer 11浏览器上执行得很好,但有些事情发生了变化,现在我收到了以下错误。

 已启动InternetExplorerDriver服务器(64位)
3.13.0.0
侦听端口32274
仅允许本地连接
[错误] [BaseTest] [startWebDriverClient]无法开始新会话。 org.openqa.selenium.SessionNotCreatedException:启动Internet Explorer时出现意外错误。 IELaunchURL()为URL'http:// localhost:32274 /'
返回HRESULT 80070012('没有更多文件'。)构建信息:版本:'3.13.0',版本:'2f0d292',时间:'2018-06-25T15:24:21.231Z'
系统信息:主持人:'LUSMIN-F00Q46Y',ip:'***。**。**。**',os.name:' Windows 7',os.arch:'amd64',os.version:'6.1',java.version:'9.0.1'
驱动程序信息:driver.version:unknown
远程堆栈跟踪:
at com.tcs.saf.base.BaseTest.startWebDriverClient(BaseTest.java:496)
at com.tcs.saf.base.BaseTest.beforeMethod(BaseTest.java:258)
at java .base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base / jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base / jdk.internal .reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base / java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.inv okeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:516)
at org.testng .internal.Invoker.invokeTestMethod(Invoker.java:707)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker) .java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

下面是我实例化IE浏览器的代码;

  if(browserType.equalsIgnoreCase(InternetExplorer)) {
try {
System.setProperty(webdriver.ie.driver,curProj +\\drive rs\\IEDriverServer.exe);
InternetExplorerOptions options = new InternetExplorerOptions();
options.introduceFlakinessByIgnoringSecurityDomains();
options.requireWindowFocus();
webdriver = new InternetExplorerDriver(options);
logger.info(getWebDriver - 将webdriver.ie.driver系统属性设置为:+ System.getProperty(webdriver.ie.driver));
} catch(IllegalStateException e){
logger.error(驱动程序可执行文件的路径必须由webdriver.ie.driver系统属性设置。,e.fillInStackTrace());
抛出新的IllegalStateException(驱动程序可执行文件的路径必须由webdriver.ie.driver系统属性设置。);
}
}


解决方案

这错误消息...

 无法启动新会话。 org.openqa.selenium.SessionNotCreatedException:启动Internet Explorer时出现意外错误。 IELaunchURL()为URL'http:// localhost:32274 /'


返回HRESULT 80070012('没有更多文件。')

...表示 IEDriverServer 无法启动/生成新的 WebBrowser IE浏览器会话。






根据



浏览器缩放级别



浏览器缩放级别必须设置为100%才能使本机鼠标事件可以设置为正确的坐标。



参考文献



您可以在以下网址找到一些详细的讨论:







My selenium test cases were executing just fine on internet explorer 11 browser but some thing got changed and now I'm getting the below error.

Started InternetExplorerDriver server (64-bit)
3.13.0.0
Listening on port 32274
Only local connections are allowed
[ERROR] [BaseTest] [startWebDriverClient] Could not start a new session.      org.openqa.selenium.SessionNotCreatedException: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:32274/'
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: 'LUSMIN-F00Q46Y', ip: '***.**.**.**', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '9.0.1'
Driver info: driver.version: unknown
remote stacktrace:
    at com.tcs.saf.base.BaseTest.startWebDriverClient(BaseTest.java:496)
    at com.tcs.saf.base.BaseTest.beforeMethod(BaseTest.java:258)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
    at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:59)
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:451)
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:222)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:516)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)

Below is my code for instantiating the IE browser;

if (browserType.equalsIgnoreCase("InternetExplorer")) {
            try {
                System.setProperty("webdriver.ie.driver", curProj+"\\drivers\\IEDriverServer.exe");
                InternetExplorerOptions options = new InternetExplorerOptions();
                options.introduceFlakinessByIgnoringSecurityDomains();
                options.requireWindowFocus();
                webdriver = new InternetExplorerDriver(options);
                logger.info("getWebDriver - Setting webdriver.ie.driver system property as: " + System.getProperty("webdriver.ie.driver"));
            } catch(IllegalStateException e) {
                logger.error("The path to the driver executable must be set by the webdriver.ie.driver system property. ",e.fillInStackTrace());
                throw new IllegalStateException("The path to the driver executable must be set by the webdriver.ie.driver system property.");
            }
        }
解决方案

This error message...

Could not start a new session. org.openqa.selenium.SessionNotCreatedException: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') for URL 'http://localhost:32274/'

...implies that the IEDriverServer was unable to initiate/spawn a new WebBrowser i.e. IE Browser session.


As per Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070012 ('There are no more files.') @JimEvans clearly mentions:


introduceFlakinessByIgnoringSecurityDomains();

As you have added the option introduceFlakinessByIgnoringSecurityDomains(); as per You're Doing It Wrong: IE Protected Mode and WebDriver @JimEvans again clearly mentions that adding options.introduceFlakinessByIgnoringSecurityDomains(); may get you past the initial exception and will allow the test to run in most cases without incident. However using this capability doesn't solve the underlying problem though. If a Protected Mode Boundary is crossed, very unexpected behavior including hangs, element location not working, and clicks not being propagated, could occur.


Solution

If you look into the Required Configuration of Internet Explorer Driver the folowing points are clearly mentioned :

Protected Mode

On Internet Explorer 7 or higher on Windows Vista or Windows 7, you must set the Protected Mode settings for each zone to be the same value. The value can be on or off, as long as it is the same for every zone. To set the Protected Mode settings you have to choose "Internet Options" from the "Tools" menu and then click on the Security tab. For each zone, there will be a check box at the bottom of the tab labeled Enable Protected Mode.

Browser Zoom Level

The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.

References

You can find some detailed discussion in:

这篇关于启动Internet Explorer时出现意外错误。 IELaunchURL()使用Selenium 3.13.0返回HRESULT 80070012:IEDriverServer_x64_3.13.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 15:26