Unable to create new remote session

后端 未结 4 1076
执笔经年
执笔经年 2020-12-17 16:55

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

Started InternetExplorerDri         


        
相关标签:
4条回答
  • 2020-12-17 17:41

    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>
    
    0 讨论(0)
  • 2020-12-17 17:42

    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.

    0 讨论(0)
  • 2020-12-17 17:45

    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.

    0 讨论(0)
  • 2020-12-17 17:50

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

    0 讨论(0)
提交回复
热议问题