com.thoughtworks.selenium
Class Wait

java.lang.Object
  extended by com.thoughtworks.selenium.Wait

public abstract class Wait
extends java.lang.Object

A utility class, designed to help the user automatically wait until a condition turns true. Use it like this:

new Wait("Couldn't find close button!") {
    boolean until() {
        return selenium.isElementPresent("button_Close");
    }
};

Author:
Dan Fabulich

Nested Class Summary
 class Wait.WaitTimedOutException
           
 
Field Summary
static long DEFAULT_INTERVAL
          The interval to pause between checking; the default is 500 milliseconds
static long DEFAULT_TIMEOUT
          The amount of time to wait before giving up; the default is 30 seconds
 
Constructor Summary
Wait()
           
Wait(java.lang.String messageToShowIfTimeout)
           
 
Method Summary
abstract  boolean until()
          Returns true when it's time to stop waiting
 void wait(java.lang.String message)
          Wait until the "until" condition returns true or time runs out.
 void wait(java.lang.String message, long timeoutInMilliseconds)
          Wait until the "until" condition returns true or time runs out.
 void wait(java.lang.String message, long timeoutInMilliseconds, long intervalInMilliseconds)
          Wait until the "until" condition returns true or time runs out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TIMEOUT

public static final long DEFAULT_TIMEOUT
The amount of time to wait before giving up; the default is 30 seconds

See Also:
Constant Field Values

DEFAULT_INTERVAL

public static final long DEFAULT_INTERVAL
The interval to pause between checking; the default is 500 milliseconds

See Also:
Constant Field Values
Constructor Detail

Wait

public Wait()

Wait

public Wait(java.lang.String messageToShowIfTimeout)
Method Detail

until

public abstract boolean until()
Returns true when it's time to stop waiting


wait

public void wait(java.lang.String message)
Wait until the "until" condition returns true or time runs out.

Parameters:
message - the failure message
timeoutInMilliseconds - the amount of time to wait before giving up
Throws:
Wait.WaitTimedOutException - if "until" doesn't return true until the timeout
See Also:
until()

wait

public void wait(java.lang.String message,
                 long timeoutInMilliseconds)
Wait until the "until" condition returns true or time runs out.

Parameters:
message - the failure message
timeoutInMilliseconds - the amount of time to wait before giving up
Throws:
Wait.WaitTimedOutException - if "until" doesn't return true until the timeout
See Also:
until()

wait

public void wait(java.lang.String message,
                 long timeoutInMilliseconds,
                 long intervalInMilliseconds)
Wait until the "until" condition returns true or time runs out.

Parameters:
message - the failure message
timeoutInMilliseconds - the amount of time to wait before giving up
intervalInMilliseconds - the interval to pause between checking "until"
Throws:
Wait.WaitTimedOutException - if "until" doesn't return true until the timeout
See Also:
until()


Copyright © 2011. All Rights Reserved.