Unable to create new remote session
Asked Answered
M

4

12

How to resolve this issue. Earlier my code was working, but IE settings were reseted by someone. Now I am getting this exception.

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)
Myrick answered 21/10, 2016 at 9:18 Comment(1)
What selenium webdriver version are you using? This week I tested webdriver version 3.0.1 and got this same exception for a Remote execution. In my local machine it's still working. Didn't have the time yet to investigate. The webdriver version I have working is 2.53.Psychognosis
S
7

This can work out of the box without the desired capability settings. Go to internet options>>Security, click on:'Reset all zones to default level and after that, ensure that the 'Enable protected mode' checkbox is ticked for all the four zones.

Stegodon answered 4/11, 2016 at 11:32 Comment(2)
This did not help in solving the same problem in Mozilla firefoxCrinkly
@ChandraShekhar, this is a solution specifically for IE, not FirefoxStegodon
S
4

First, check your default zoom level in Internet Explorer. If it's not 100% then do the following steps:

  • Open Internet Explorer.

  • Press Alt + X and then click on Internet Options.

  • Click on the Advanced tab.

  • Place a check mark on "Reset Zoom level for new Windows and tab"

  • Press Apply and ok.

  • Close and open Internet Explorer window and check if the Default Zoom is set to 100 %.

Once you have done with above steps, add following lines in your code:

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

Now run your program and it should work.

Hope it will help!!

Swansea answered 23/10, 2016 at 9:47 Comment(0)
H
1

The issue is discussed on Selenium project on Github

Here is the quote of the most relevant/informative part which helped me to solve the issue:

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.

Holinshed answered 19/12, 2016 at 11:6 Comment(0)
B
0

I had the same issue (in my case 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}}]

Using Selenium driver 3.3.1:

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>3.3.1</version>
</dependency>

And solved it via another version like 3.4+.

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>3.4.0</version>
</dependency>
Babita answered 1/8, 2019 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.