UnreachableBrowserException trying to launch in Selenium Webdriver using IEDriver

前端 未结 7 1787
生来不讨喜
生来不讨喜 2021-01-15 09:30

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 Sel

7条回答
  •  借酒劲吻你
    2021-01-15 09:51

    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");
                    }
                }
            }
    

提交回复
热议问题