protected URL prepareRemoteUrl() { URL url = null; if (CustomProperties.getRemote() != null) { url = URLUtils.getURL(CustomProperties.getRemote()); } return url; }
private RemoteWebDriver invokeDriverCreationTask(Callable<RemoteWebDriver> task) { int timeout = CustomProperties.getDriverTimeoutCreation(); // in seconds RemoteWebDriver driver = FutureTaskUtils.invokeTask(task, timeout); if (driver == null) { log.warn("Failed to created WebDriver instance, will try one more time."); } return driver; }
public RemoteWebDriver startDriver(Callable<RemoteWebDriver> task) { RemoteWebDriver driver = invokeDriverCreationTask(task); int driverCreationAttempts = CustomProperties.getDriverCreationAttempts(); int counter = 0; while (driver == null && counter != driverCreationAttempts) { driver = invokeDriverCreationTask(task); counter++; if (counter == driverCreationAttempts && driver == null) throw new WebDriverException( "Failed to create new instance of WebDriver after " + driverCreationAttempts + " attempts!"); } return driver; }