io.selendroid.android
Class AndroidWait

java.lang.Object
  extended by io.selendroid.android.AndroidWait
All Implemented Interfaces:
Wait<Void>

public class AndroidWait
extends Object
implements Wait<Void>

An implementation of the Wait interface that makes use of Android Native WebDriver.

Author:
Tomohiro Kaizu

Field Summary
static long DEFAULT_SLEEP_INTERVAL
           
 
Constructor Summary
  AndroidWait()
          Constructs an instance with default settings: 100 ms for sleep interval and 1 second for timeout.
protected AndroidWait(Clock clock, long sleepIntervalInMillis, long timeoutInMillis)
           
 
Method Summary
 long getTimeoutInMillis()
          Gets the time limit in milliseconds.
 void setTimeoutInMillis(long timeoutInMillis)
          Sets the time limit in milliseconds.
protected  void sleep()
          Sleeps for a few milliseconds.
<T> T
until(Function<Void,T> isTrue)
          Implementations should wait until the condition evaluates to a value that is neither null nor false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SLEEP_INTERVAL

public static final long DEFAULT_SLEEP_INTERVAL
See Also:
Constant Field Values
Constructor Detail

AndroidWait

public AndroidWait()
Constructs an instance with default settings: 100 ms for sleep interval and 1 second for timeout.


AndroidWait

protected AndroidWait(Clock clock,
                      long sleepIntervalInMillis,
                      long timeoutInMillis)
Parameters:
clock - clock to use when measuring the timeout
sleepIntervalInMillis - amount of time to sleep between attempts in milliseconds
timeoutInMillis - timeout in milliseconds
Method Detail

until

public <T> T until(Function<Void,T> isTrue)
Description copied from interface: Wait
Implementations should wait until the condition evaluates to a value that is neither null nor false. Because of this contract, the return type must not be Void.

If the condition does not become true within a certain time (as defined by the implementing class), this method will throw a non-specified Throwable. This is so that an implementor may throw whatever is idiomatic for a given test infrastructure (e.g. JUnit4 would throw AssertionError.

Specified by:
until in interface Wait<Void>
Type Parameters:
T - the return type of the method, which must not be Void
Parameters:
isTrue - the parameter to pass to the ExpectedCondition

sleep

protected void sleep()
Sleeps for a few milliseconds.


setTimeoutInMillis

public void setTimeoutInMillis(long timeoutInMillis)
Sets the time limit in milliseconds.

Parameters:
timeoutInMillis - time limit

getTimeoutInMillis

public long getTimeoutInMillis()
Gets the time limit in milliseconds.

Returns:
time limit


Copyright © 2014. All rights reserved.