Java 类org.openqa.selenium.support.ui.Sleeper 实例源码

项目:minium    文件:AsyncTimeElapsedInteraction.java   
@Override
public void waitUntilCompleted() {
    try {
        long end = MILLISECONDS.convert(duration.getTime(), duration.getUnit());
        long time = (start + end) - System.currentTimeMillis();

        if (time > 0) {
            Sleeper.SYSTEM_SLEEPER.sleep(new org.openqa.selenium.support.ui.Duration(time, MILLISECONDS));
        }
    } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new RuntimeException(e);
    } finally {
        start = -1;
    }
}
项目:ScriptDriver    文件:RunTests.java   
private void sleepSeconds(long seconds) {
    try {
        Sleeper.SYSTEM_SLEEPER.sleep(new Duration(seconds, java.util.concurrent.TimeUnit.SECONDS));
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
项目:ScriptDriver    文件:RunTests.java   
private void sleep(long ms) {
    try {
        Sleeper.SYSTEM_SLEEPER.sleep(new Duration(ms, java.util.concurrent.TimeUnit.MILLISECONDS));
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
}
项目:redsniff    文件:Waiter.java   
public void sleep(Duration duration) {
    try {
        Sleeper.SYSTEM_SLEEPER.sleep(duration);
    } catch (InterruptedException e) {
        throw new RuntimeException(e);
    }
}
项目:cinnamon    文件:SearchContextWait.java   
protected SearchContextWait(final SearchContext input, final Clock clock, final Sleeper sleeper, final long timeout,
        final TimeUnit timeoutTimeUnit, final long sleep, final TimeUnit sleepTimeUnit) {
    super(input, clock, sleeper);
    withTimeout(timeout, timeoutTimeUnit);
    pollingEvery(sleep, sleepTimeUnit);
    ignoring(NotFoundException.class);
}
项目:selenium-lxc    文件:SeleniumWait.java   
public SeleniumWait(WebDriver input) {
    super(input, new SystemClock(), new Sleeper() {
        @Override
        public void sleep(Duration duration) {
        }
    });

    ignoring(NoSuchElementException.class, StaleElementReferenceException.class);
    pollingEvery(100, TimeUnit.MILLISECONDS);
}
项目:gwt-d3    文件:DemoApplication.java   
private DemoApplication(final WebDriver driver) {
       super(driver);
    try {
        Sleeper.SYSTEM_SLEEPER.sleep(new Duration(5, TimeUnit.SECONDS));
    } catch (InterruptedException e) {
        throw new RuntimeException("cannot wait", e);
   }
}
项目:gwt-d3    文件:DemoApplication.java   
public DemoDragMultiple revealDemoDragMultiple() {
try {
    Sleeper.SYSTEM_SLEEPER.sleep(new Duration(5, TimeUnit.SECONDS));
      return new DemoDragMultiple(driver, this).reveal();
} catch (InterruptedException e) {
    throw new RuntimeException("do the thing ");
}
  }
项目:PrOfESSOS    文件:BrowserSimulator.java   
protected void waitMillis(long timeout) throws InterruptedException {
    Sleeper.SYSTEM_SLEEPER.sleep(new Duration(timeout, TimeUnit.MILLISECONDS));
}
项目:easytest    文件:WebDriverWait2.java   
public WebDriverWait2(final WebDriver driver, final long timeOutInSeconds, final long sleepInMillis) {
    super(driver, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInSeconds, sleepInMillis);
}
项目:AugmentedDriver    文件:WebElementWait.java   
public WebElementWait(SearchContext element, long timeoutInSeconds) {
    super(element, new SystemClock(), Sleeper.SYSTEM_SLEEPER);
    withTimeout(timeoutInSeconds, TimeUnit.SECONDS);
    pollingEvery(500, TimeUnit.MILLISECONDS);
    ignoring(WebDriverException.class);
}
项目:cinnamon    文件:SearchContextWait.java   
public SearchContextWait(final SearchContext input, final long timeoutMillis) {
    this(input, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeoutMillis, TimeUnit.MILLISECONDS, DEFAULT_SLEEP_TIMEOUT, TimeUnit.MILLISECONDS);
}
项目:cinnamon    文件:SearchContextWait.java   
public SearchContextWait(final SearchContext input, final long timeoutMillis, final long sleepMillis) {
    this(input, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeoutMillis, TimeUnit.MILLISECONDS, sleepMillis, TimeUnit.MILLISECONDS);
}
项目:Selenium-Foundation    文件:SearchContextWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 * 
 * @param context
 *            The SearchContext instance to pass to the expected conditions
 * @param clock
 *            The clock to use when measuring the timeout
 * @param sleeper
 *            Object used to make the current thread go to sleep.
 * @param timeOutInSeconds
 *            The timeout in seconds when an expectation is
 * @param sleepTimeOut
 *            The timeout used whilst sleeping. Defaults to 500ms called.
 */
public SearchContextWait(SearchContext context, Clock clock, Sleeper sleeper, long timeOutInSeconds,
        long sleepTimeOut) {
    super(context, clock, sleeper);
    withTimeout(timeOutInSeconds, TimeUnit.SECONDS);
    pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS);
    ignoring(NotFoundException.class);
    this.context = context;
}
项目:qaf    文件:QAFWebDriverWait.java   
/**
 * @param driver
 *            The WebDriver instance to pass to the expected conditions
 * @param clock
 *            The clock to use when measuring the timeout
 * @param sleeper
 *            Object used to make the current thread go to sleep.
 * @param timeOutInSeconds
 *            The timeout in seconds when an expectation is
 * @param sleepTimeOut
 *            The timeout used whilst sleeping. Defaults to 500ms called.
 */
protected QAFWebDriverWait(QAFExtendedWebDriver driver, Clock clock, Sleeper sleeper,
        long timeOutInMiliSeconds, long sleepTimeOut) {
    super(driver, clock, sleeper);
    withTimeout(timeOutInMiliSeconds, TimeUnit.MILLISECONDS);
    pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS);
    ignoring(StaleElementReferenceException.class);
}
项目:qaf    文件:QAFWebElementWait.java   
/**
 * @param element
 *            The WebElement instance to pass to the expected conditions
 * @param clock
 *            The clock to use when measuring the timeout
 * @param sleeper
 *            Object used to make the current thread go to sleep.
 * @param timeOutInSeconds
 *            The timeout in seconds when an expectation is
 * @param sleepTimeOut
 *            The timeout used whilst sleeping. Defaults to 500ms called.
 */
@SuppressWarnings("unchecked")
protected QAFWebElementWait(QAFExtendedWebElement element, Clock clock, Sleeper sleeper, long timeOutInMiliSeconds,
        long sleepTimeOut) {
    super(element, clock, sleeper);
    withTimeout(timeOutInMiliSeconds, TimeUnit.MILLISECONDS);
    pollingEvery(sleepTimeOut, TimeUnit.MILLISECONDS);
    ignore(NoSuchElementException.class, StaleElementReferenceException.class);
}
项目:Selenium-Foundation    文件:SearchContextWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 *
 * @param context
 *            The SearchContext instance to pass to the expected conditions
 * @param timeOutInSeconds
 *            The timeout in seconds when an expectation is called
 * @see SearchContextWait#ignoring(java.lang.Class)
 */
public SearchContextWait(SearchContext context, long timeOutInSeconds) {
    this(context, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInSeconds, DEFAULT_SLEEP_TIMEOUT);
}
项目:Selenium-Foundation    文件:SearchContextWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 *
 * @param context
 *            The SearchContext instance to pass to the expected conditions
 * @param timeOutInSeconds
 *            The timeout in seconds when an expectation is called
 * @param sleepInMillis
 *            The duration in milliseconds to sleep between polls.
 * @see SearchContextWait#ignoring(java.lang.Class)
 */
public SearchContextWait(SearchContext context, long timeOutInSeconds, long sleepInMillis) {
    this(context, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInSeconds, sleepInMillis);
}
项目:qaf    文件:QAFWebDriverWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 * 
 * @param driver
 *            The WebDriver instance to pass to the expected conditions
 * @param timeOutInMiliSeconds
 *            The timeout in seconds when an expectation is called
 * @see QAFWebDriverWait#ignoring(Class[]) equals
 */
public QAFWebDriverWait(QAFExtendedWebDriver driver, long timeOutInMiliSeconds) {
    this(driver, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds,
            getDefaultInterval());
}
项目:qaf    文件:QAFWebDriverWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 * 
 * @param driver
 *            The WebDriver instance to pass to the expected conditions
 * @param timeOutInMiliSeconds
 *            The timeout in seconds when an expectation is called
 * @param sleepInMillis
 *            The duration in milliseconds to sleep between polls.
 * @see QAFWebDriverWait#ignoring(Class[]) equals
 */
public QAFWebDriverWait(QAFExtendedWebDriver driver, long timeOutInMiliSeconds,
        long sleepInMillis) {
    this(driver, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds,
            sleepInMillis);
}
项目:qaf    文件:QAFWebElementWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 * 
 * @param element
 *            The WebElement instance to pass to the expected conditions
 * @param timeOutInMiliSeconds
 *            The timeout in seconds when an expectation is called
 * @see QAFWebElementWait#ignoring(Class[]) equals
 */
public QAFWebElementWait(QAFExtendedWebElement element, long timeOutInMiliSeconds) {
    this(element, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds, getDefaultInterval());
}
项目:qaf    文件:QAFWebElementWait.java   
/**
 * Wait will ignore instances of NotFoundException that are encountered
 * (thrown) by default in the 'until' condition, and immediately propagate
 * all others. You can add more to the ignore list by calling
 * ignoring(exceptions to add).
 * 
 * @param element
 *            The WebElement instance to pass to the expected conditions
 * @param timeOutInMiliSeconds
 *            The timeout in seconds when an expectation is called
 * @param sleepInMillis
 *            The duration in milliseconds to sleep between polls.
 * @see QAFWebElementWait#ignoring(Class[]) equals
 */
public QAFWebElementWait(QAFExtendedWebElement element, long timeOutInMiliSeconds, long sleepInMillis) {
    this(element, new SystemClock(), Sleeper.SYSTEM_SLEEPER, timeOutInMiliSeconds, sleepInMillis);
}