无法创建新的远程会话
Unable to create new remote session
如何解决这个问题。早些时候我的代码可以正常工作,但 IE 设置已被某人重置。现在我遇到了这个异常。
Started InternetExplorerDriver server (32-bit)
2.53.1.0
Listening on port 16183
Only local connections are allowed
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}], required capabilities = null
Build info: version: 'unknown', revision: '3169782', time: '2016-09-29 10:24:50 -0700'
System info: host: 'BWT12654001', ip: '10.52.132.157', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:144)
at mypackage.TestIEBrowser.main(TestIEBrowser.java:33)
首先,检查您在 Internet Explorer 中的默认缩放级别。如果不是 100%,则执行以下步骤:
打开 Internet Explorer。
按 Alt + X,然后单击“Internet 选项”。
单击“高级”选项卡。
勾选"Reset Zoom level for new Windows and tab"
按应用并确定。
关闭并打开 Internet Explorer window 并检查默认缩放是否
设置为 100%。
完成上述步骤后,在代码中添加以下行:
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
现在 运行 您的程序应该可以运行了。
希望对您有所帮助!!
这可以开箱即用,无需所需的功能设置。转到 Internet 选项>>安全,单击:'将所有区域重置为默认级别,然后确保勾选所有四个区域的 'Enable protected mode' 复选框。
这个问题在 Selenium project on Github
上讨论
这是帮助我解决问题的最 relevant/informative 部分的引述:
The good news is that it looks like the IE driver mostly works with IE11, provided
that (a) all security zones are set to the same Protected Mode setting and (b) Enhanced
Protected Mode is turned off. Note that the standard registry checks that the IE driver
uses to test for Protected Mode settings in IE7-10 are broken for IE11, and we've never
made any attempt to check for Enhanced Protected Mode, so there's no warning (yet)
if you don't have these settings properly set.
The bad news is that cookie manipulation is broken. Badly. If you attempt to set or
retrieve cookies, there's a chance that you'll end up with the "Unable to get browser"
error encountered before. At the moment, there is no workaround for that.
我遇到了同样的问题(在我的情况下是 Firefox):
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}, version=, platform=ANY}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
使用 Selenium 驱动程序 3.3.1:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
并通过 3.4+.
等另一个版本解决了它
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>
如何解决这个问题。早些时候我的代码可以正常工作,但 IE 设置已被某人重置。现在我遇到了这个异常。
Started InternetExplorerDriver server (32-bit)
2.53.1.0
Listening on port 16183
Only local connections are allowed
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to straight W3C remote end connection
Oct 21, 2016 10:14:12 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Falling back to original OSS JSON Wire Protocol.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{ensureCleanSession=true, browserName=internet explorer, version=, platform=WINDOWS}], required capabilities = null
Build info: version: 'unknown', revision: '3169782', time: '2016-09-29 10:24:50 -0700'
System info: host: 'BWT12654001', ip: '10.52.132.157', os.name: 'Windows Server 2008 R2', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: driver.version: InternetExplorerDriver
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:80)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:141)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:602)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:242)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:228)
at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:180)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)
at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:144)
at mypackage.TestIEBrowser.main(TestIEBrowser.java:33)
首先,检查您在 Internet Explorer 中的默认缩放级别。如果不是 100%,则执行以下步骤:
打开 Internet Explorer。
按 Alt + X,然后单击“Internet 选项”。
单击“高级”选项卡。
勾选"Reset Zoom level for new Windows and tab"
按应用并确定。
关闭并打开 Internet Explorer window 并检查默认缩放是否 设置为 100%。
完成上述步骤后,在代码中添加以下行:
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);
现在 运行 您的程序应该可以运行了。
希望对您有所帮助!!
这可以开箱即用,无需所需的功能设置。转到 Internet 选项>>安全,单击:'将所有区域重置为默认级别,然后确保勾选所有四个区域的 'Enable protected mode' 复选框。
这个问题在 Selenium project on Github
上讨论这是帮助我解决问题的最 relevant/informative 部分的引述:
The good news is that it looks like the IE driver mostly works with IE11, provided that (a) all security zones are set to the same Protected Mode setting and (b) Enhanced Protected Mode is turned off. Note that the standard registry checks that the IE driver uses to test for Protected Mode settings in IE7-10 are broken for IE11, and we've never made any attempt to check for Enhanced Protected Mode, so there's no warning (yet) if you don't have these settings properly set.
The bad news is that cookie manipulation is broken. Badly. If you attempt to set or retrieve cookies, there's a chance that you'll end up with the "Unable to get browser" error encountered before. At the moment, there is no workaround for that.
我遇到了同样的问题(在我的情况下是 Firefox):
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Unable to create new remote session. desired capabilities = Capabilities [{marionette=true, browserName=firefox, moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}, version=, platform=ANY}], required capabilities = Capabilities [{moz:firefoxOptions={binary=Optional.empty, args=[], legacy=null, logLevel=null, prefs={}, profile=null}}]
使用 Selenium 驱动程序 3.3.1:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.3.1</version>
</dependency>
并通过 3.4+.
等另一个版本解决了它<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.4.0</version>
</dependency>