Example usage for org.openqa.selenium TimeoutException TimeoutException

List of usage examples for org.openqa.selenium TimeoutException TimeoutException

Introduction

In this page you can find the example usage for org.openqa.selenium TimeoutException TimeoutException.

Prototype

public TimeoutException() 

Source Link

Usage

From source file:com.cognifide.qa.bb.wait.BobcatWaitTest.java

License:Apache License

@Test
public void isConditionMetShouldCatchTimeoutExceptionAndReturnBoolean() {
    when(condition.apply(any())).thenThrow(new TimeoutException());

    boolean result = true;
    try {/*  w ww. j a  v  a2  s. co  m*/
        result = tested.isConditionMet(condition);
    } catch (TimeoutException e) {
        fail("Exception should not be thrown");
    }
    assertThat(result).isFalse();
}

From source file:com.owncloud.android.test.ui.testSuites.Common.java

License:Open Source License

public static void waitTillElementIsNotPresent(AndroidElement element, int pollingTime) throws Exception {
    for (int time = 0; time <= waitingTime * 1000; time += pollingTime) {
        try {// ww  w  .j  av  a 2s. c o  m
            element.isDisplayed();
        } catch (NoSuchElementException e) {
            return;
        }
        Thread.sleep(pollingTime);
    }
    throw new TimeoutException();
}