问题 无法创建新的远程会话


如何解决此问题。早些时候我的代码正在运行,但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)

10069
2017-10-21 09:18


起源

什么 selenium webdriver 您使用的版本?本周我测试了 webdriver 版 3.0.1 并为远程执行获得了同样的异常。在我的本地机器上,它仍在工作。没有时间去调查。该 webdriver 我工作的版本是 2.53。 - Tom


答案:


这可以在没有所需功能设置的情况下开箱即用。转到互联网选项>>安全性,单击:'将所有区域重置为默认级别,然后确保勾选所有四个区域的'启用保护模式'复选框。


6
2017-11-04 11:32



这无助于解决Mozilla Firefox中的同样问题 - Chandra Shekhar


首先,检查Internet Explorer中的默认缩放级别。如果不是100%,请执行以下步骤:

  • 打开Internet Explorer。

  • 按Alt + X,然后单击“Internet选项”。

  • 单击“高级”选项卡。

  • 勾选“重置新窗口和选项卡的缩放级别”

  • 按Apply并确定。

  • 关闭并打开Internet Explorer窗口并检查默认缩放 设置为100%。

完成上述步骤后,在代码中添加以下行:

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true);

现在运行你的程序,它应该工作。

希望它会有所帮助!!


4
2017-10-23 09:47





讨论了这个问题 Github上的Selenium项目

以下是帮助我解决问题的最相关/信息部分的引用:

好消息是它看起来像IE驱动程序 大多 与IE11一起提供   (a)所有安全区域设置为相同的保护模式设置,(b)增强   保护模式已关闭。请注意,标准注册表检查IE驱动程序   用于测试IE7-10中的保护模式设置是否已被IE11破坏,我们从未这样做过   任何尝试检查增强保护模式,所以没有警告(尚)   如果您没有正确设置这些设置。

坏消息是cookie操作被打破了。厉害。如果您尝试设置或   检索cookie,你有可能最终得到“无法获取浏览器”   之前遇到的错误。目前,还没有解决方法。


1
2017-12-19 11:06