Search code examples
javaseleniuminternet-explorer-11selenium-iedriveriedriverserver

org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session error with Selenium and IE11 using Java


I'm trying to automate my test cases using Selenium with the following software applications.

  • WebDriver 3.12.0
  • InternetExplorerDriver3.150.1
  • IE11 browser
  • Java1.8.0.231

Here's my script to initialize the driver.

System.setProperty("webdriver.ie.driver","driver path");
driver = new InternetExplorerDriver();
System.out.println("Driver initialized.");
driver.get("application web url");

For the above script, I'm getting the below error message.

org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session....

I have tried with different versions of drivers and selenium webdriver. But didn't workout. What could be the cause and how can I resolve it?

Could anyone give me your suggestions?

Thanks,
Karunagara Pandi G


Solution

  • This error message...

    org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session....
    

    ...implies that the IEDriverServer was unable to initiate/spawn a new WebBrowsing Session i.e. InternetExplorer Browser session.

    Your main issue is the incompatibility between the version of the binaries you are using as follows:

    • Your Selenium WebDriver Client version is 3.12.0 which is a bit older.
    • Your InternetExplorerDriver version 3.150.1.

    So there is a clear mismatch between Selenium Client v3.12.0 , IEDriverServer v3.150.1.


    Solution

    • Upgrade Selenium to current levels Version 3.141.59.
    • Upgrade IEDriverServer to IEDriverServer v3.141.59 or IEDriverServer v3.150.0 level.
    • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
    • Execute your Test as a non-root user.
    • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.

    tl; dr