UnreachableBrowserException trying to launch in Selenium Webdriver using IEDriver

54,376

Solution 1

I was hitting this same error and then found this question. In my case, it turned out that I had the 64 bit version of the IEDriver.exe on my system, but I was on a 32 bit windows platform. So this error was indicating that the OS failed to execute the driver program. I tried to run the driver directly in a command prompt to see that infact the 32 bit OS was not recognizing the 64 bit driver exe as an executable program.

Getting the correct 32 bit IEDriver.exe solved my problem.

Solution 2

Go to hosts (C:\Windows\system32\drivers\etc) and make sure that you have this line correctly: 127.0.0.1 localhost

Solution 3

Selenium WebDriver with Chrome, issue:

(org.openqa.selenium.remote.UnreachableBrowserException) solution
Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
Build info: version: '2.35.0', revision: '8df0c6b', time: '2013-08-12 15:43:19'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_40'
Driver info: driver.version: ChromeDriver

If you are getting above problem, go to the chromedriver.exe location and try to execute the exe. If you are able to execute the exe then below code will work. Otherwise it will be a permission issue to the chromedriver folder. Change the folder location or provide the permission to the folder and double click on chromedriver.exe.

Solution:

  System.setProperty("webdriver.chrome.driver", "C:/Driver/chromedriver.exe");
  System.out.println(System.getProperty("webdriver.chrome.driver"));

  WebDriver driver3 = new ChromeDriver();

Solution 4

Faced similar exception while trying to execute Selenium script over BrowserStack for mobile devices. And often found this exception being thrown. Eventually realized being virtual machines involved, emulators were taking time to boot up and thus causing UnreachableBrowserException.

Wrote below code to handle this, by setting Number of times to retry(RetryCount) and made multiple attempts(retryAttempt) to check Remote WebDriver's availability.

while(retryAttempt<=retryCount){
            try{

                WebDriver driver = new RemoteWebDriver(new URL(URL), caps);
                return driver;
            }
            catch(UnreachableBrowserException e){
                Thread.sleep(10000);
                if(retryAttempt>retryCount){
                    logger.error("Remote Web Driver cannot be reached at this moment");
                }
            }
        }

Solution 5

It seems to me you use improper driver initilization. Try piece of code from my project:

File file = new File("C:/Selenium/iexploredriver.exe");
System.setProperty("webdriver.ie.driver", file.getAbsolutePath());
WebDriver driver = new InternetExplorerDriver();
Share:
54,376
StackExchange What The Heck
Author by

StackExchange What The Heck

Radically disappointed with SE since late 2019.

Updated on February 19, 2020

Comments

  • StackExchange What The Heck
    StackExchange What The Heck about 4 years

    I have a set of automations that work fantastically in Firefox and Chrome, and I'd like to launch an instance of IEDriver as well.

    I've set up IEDriver as per Selenium's Google Code wiki, with the correct path (if I change the path I get a different exception, so it's definitely correct). But for some reason it still can't launch, and just times out.

    The code to launch it (the last line throws the exception):

            File ieDriver = new File("C:/Users/whatever/path/IEDriverServer.exe");
            System.setProperty("webdriver.ie.driver", ieDriver.getAbsolutePath());
            WebDriver ie = new InternetExplorerDriver();
    

    And the exception is:

    Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
    Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17'
    System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_21'
    Driver info: driver.version: InternetExplorerDriver
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:216)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:201)
        at org.openqa.selenium.ie.InternetExplorerDriver.run(InternetExplorerDriver.java:184)
        at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:174)
        at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:143)
        at uk.co.know.kiteTest.WebDriverManager.<init>(WebDriverManager.java:52)
        at uk.co.know.kiteTest.RunAutomations.main(RunAutomations.java:13)
    Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
    Build info: version: '2.33.0', revision: '4ecaf82108b2a6cc6f006aae81961236eba93358', time: '2013-05-22 12:00:17'
    System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0_21'
    Driver info: driver.version: InternetExplorerDriver
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:165)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:527)
        ... 7 more
    Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:38622/status] to be available after 20014 ms
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:104)
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163)
        ... 9 more
    Caused by: com.google.common.util.concurrent.UncheckedTimeoutException: java.util.concurrent.TimeoutException
        at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:143)
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79)
        ... 10 more
    
  • StackExchange What The Heck
    StackExchange What The Heck almost 11 years
    Ah, sorry - I'd created the variable earlier in the code but forgotten to include it in the snippet. I've edited the question to reflect this now. I also copy/pasted your code, modifying the path to the driver exe of course, but no go :( Thanks though.
  • StackExchange What The Heck
    StackExchange What The Heck over 10 years
    I've given it a try, but no joy, unfortunately :( That said, for others who might find it useful, here's the reference for the INTRODUCE_FLAKINESS arg: selenium.googlecode.com/git/docs/api/java/org/openqa/seleniu‌​m/… and a useful reference for DesiredCapabilities: selenium.googlecode.com/git/docs/api/java/org/openqa/seleniu‌​m/…
  • StackExchange What The Heck
    StackExchange What The Heck about 10 years
    Thanks for the response here... unfortunately the issue I've posted is specifically to do with IEDriver, not Chrome...