Gourav Sinha
Gourav Sinha

Reputation: 315

Unable to create new remote session

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)

Upvotes: 12

Views: 54797

Answers (4)

invzbl3
invzbl3

Reputation: 6440

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>

Upvotes: 0

Jonatan Kaźmierczak
Jonatan Kaźmierczak

Reputation: 1911

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.

Upvotes: 1

Testilla
Testilla

Reputation: 692

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.

Upvotes: 7

Harshil Doshi
Harshil Doshi

Reputation: 3592

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!!

Upvotes: 4

Related Questions