org.openqa.selenium.SessionNotCreatedException 在触发 IE 模式下的 Edge 浏览器时发生

huangapple go评论106阅读模式
英文:

org.openqa.selenium.SessionNotCreatedException while triggering the Edge Browser in IE Mode

问题

我的应用程序在Edge浏览器中不起作用,在Edge浏览器(版本105)中启用IE兼容模式后可以正常工作。我正在使用Selenium 4

我尝试在IE模式下启动EDGE浏览器,但遇到以下错误:

仅允许本地连接
org.openqa.selenium.SessionNotCreatedException: 无法启动新会话。响应代码500。消息:意外错误启动Internet Explorer。 IELaunchURL()返回HRESULT 80070002('系统找不到指定的文件。')用于URL'http://localhost:52310/' 
构建信息:版本:'4.1.1',修订版本:'e8fcc2cecf' 
系统信息:主机:'ABCDEFGHIJ',IP:'12345678',操作系统名称:'Windows Server 2016',操作系统架构:'amd64',操作系统版本:'10.0',Java版本:'1.8.0_144' 
驱动程序信息:org.openqa.selenium.ie.InternetExplorerDriver 
命令:[null,newSession {capabilities = [Capabilities {browserName: internet explorer,se:ieOptions:{ie.edgechromium:true,ie.edgepath:C:\ Program Files(x86)\ Micr ...}}],desiredCapabilities = Capabilities {browserName: internet explorer,ie.edgechromium:true,ie.edgepath:C:\ Program Files(x86)\ Micr ...},se:ieOptions:{ie.edgechromium:true,ie.edgepath:C:\ Program Files(x86)\ Micr ...}}}]
Capabilities {}
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)

我已经按照以下链接中提供的指南操作:

https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ie-mode?tabs=java

我正在使用2016年的Windows虚拟机,我的代码如下:

System.setProperty("webdriver.ie.driver", GlobalSettings.IE_DRIVER_PATH);
InternetExplorerOptions IEOptionsEdge = setInternetExlopererForEdge();
driver = new InternetExplorerDriver(IEOptionsEdge);

private static InternetExplorerOptions setInternetExlopererForEdge() 
{
    InternetExplorerOptions IEOptions  = new InternetExplorerOptions();
    IEOptions.attachToEdgeChrome();
    IEOptions.ignoreZoomSettings();
    IEOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
    return IEOptions;
}
英文:

My application doesn't work in the Edge browser, but works fine in the Edge Browser(Version 105) with IE Compatibility Mode. Am using Selenium 4

I have tried to invoke the EDGE browser in IE Mode and ended up in the following error:

Only local connections are allowed
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: Unexpected error launching Internet Explorer. IELaunchURL() returned HRESULT 80070002 ('The system cannot find the file specified.') for URL 'http://localhost:52310/'
Build info: version: '4.1.1', revision: 'e8fcc2cecf'
System info: host: 'ABCDEFGHIJ', ip: '12345678', os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: internet explorer, se:ieOptions: {ie.edgechromium: true, ie.edgepath: C:\Program Files (x86)\Micr...}}], desiredCapabilities=Capabilities {browserName: internet explorer, ie.edgechromium: true, ie.edgepath: C:\Program Files (x86)\Micr..., se:ieOptions: {ie.edgechromium: true, ie.edgepath: C:\Program Files (x86)\Micr...}}}]
Capabilities {}
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
	at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:84)

I have followed the guidelines given in the below link:

https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ie-mode?tabs=java

And am using 2016 Windows VM and the code I used as below

System.setProperty("webdriver.ie.driver", GlobalSettings.IE_DRIVER_PATH);
    	InternetExplorerOptions IEOptionsEdge = setInternetExlopererForEdge();
driver = new InternetExplorerDriver(IEOptionsEdge);

    private static InternetExplorerOptions setInternetExlopererForEdge() 
    {
    	InternetExplorerOptions IEOptions  = new InternetExplorerOptions();
    	IEOptions.attachToEdgeChrome();
        IEOptions.ignoreZoomSettings();
    	IEOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
    	return IEOptions;
    }

答案1

得分: 1

我在 Selenium GitHub 问题中看到了你的帖子,似乎通过更新你的 IE 驱动程序已经解决了这个问题。

至于"重新安装 Microsoft Edge"的问题,我有一个解决方法可以帮助你摆脱它:

HKLM\SOFTWARE\Microsoft\Internet Explorer\EdgeIntegration下创建一个 DWORD Supported 值,并将其值设置为 1
一个示例可能是:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\EdgeIntegration]
"Supported"=dword:00000001
英文:

I saw your post on Selenium GitHub issues and it seems to be fixed by updating your IE Driver.

As to the "reinstall Microsoft Edge" problem, I have a workaround to help you get rid of it:

Create a DWORD Supported value under HKLM\SOFTWARE\Microsoft\Internet Explorer\EdgeIntegration and set its value to 1.
An example would be

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\EdgeIntegration]
"Supported"=dword:00000001

huangapple
  • 本文由 发表于 2023年6月1日 23:22:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76383457.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定