org.openqa.selenium.net.UrlChecker Java Examples
The following examples show how to use
org.openqa.selenium.net.UrlChecker.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppiumServer.java From agent with MIT License | 6 votes |
@Override public synchronized void start() { if (isRunning) { return; } int port = PortProvider.getAppiumServerAvailablePort(); String startCmd; if (StringUtils.isEmpty(APPIUM_JS)) { startCmd = String.format("appium -p %d --session-override", port); } else { startCmd = String.format("node %s -p %d --session-override", APPIUM_JS, port); } try { watchdog = Terminal.executeAsyncAndGetWatchdog(startCmd); String url = String.format("http://localhost:%d/wd/hub", port); this.url = new URL(url); new UrlChecker().waitUntilAvailable(60, TimeUnit.SECONDS, new URL(url + "/status")); isRunning = true; } catch (Exception e) { throw new RuntimeException("启动appium server失败", e); } }
Example #2
Source File: DeviceServer.java From agent with MIT License | 5 votes |
public boolean isAvailable(int checkTimeoutInSeconds) { try { new UrlChecker() .waitUntilAvailable(checkTimeoutInSeconds, TimeUnit.SECONDS, new URL(url.toString() + "/status")); return true; } catch (Exception e) { log.warn("{} is not availabe, check timeout: {} s", url, checkTimeoutInSeconds); return false; } }
Example #3
Source File: ReferrerTest.java From selenium with Apache License 2.0 | 5 votes |
void start() { try { server.start(); new UrlChecker().waitUntilAvailable(10, TimeUnit.SECONDS, new URL(getBaseUrl())); } catch (Exception e) { throw new RuntimeException(e); } }
Example #4
Source File: AppiumDriverLocalService.java From java-client with Apache License 2.0 | 4 votes |
private void ping(long time, TimeUnit timeUnit) throws UrlChecker.TimeoutException, MalformedURLException { // The operating system might block direct access to the universal broadcast IP address URL status = new URL(url.toString().replace(BROADCAST_IP_ADDRESS, "127.0.0.1") + "/status"); new UrlChecker().waitUntilAvailable(time, timeUnit, status); }