类org.openqa.selenium.net.UrlChecker源码实例Demo

下面列出了怎么用org.openqa.selenium.net.UrlChecker的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: agent   文件: AppiumServer.java
@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);
    }

}
 
源代码2 项目: agent   文件: DeviceServer.java
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;
    }
}
 
源代码3 项目: selenium   文件: ReferrerTest.java
void start() {
  try {
    server.start();
    new UrlChecker().waitUntilAvailable(10, TimeUnit.SECONDS, new URL(getBaseUrl()));
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}
 
源代码4 项目: java-client   文件: AppiumDriverLocalService.java
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);
}
 
 类所在包
 类方法
 同包方法