webdriver-0.3.0.1: a Haskell client for the Selenium WebDriver protocol

Safe HaskellSafe-Infered

Test.WebDriver.Commands.Wait

Contents

Synopsis

Wait on expected conditions

waitUntil :: SessionState m => Double -> m a -> m aSource

Wait until either the given action succeeds or the timeout is reached. The action will be retried every .25 seconds until no ExpectFailed or NoSuchElement exceptions occur. If the timeout is reached, then a Timeout exception will be raised. The timeout value is expressed in seconds.

waitUntil' :: SessionState m => Int -> Double -> m a -> m aSource

Similar to waitUntil but allows you to also specify the poll frequency of the WD action. The frequency is expressed as an integer in microseconds.

waitWhile :: SessionState m => Double -> m a -> m ()Source

Like waitUntil, but retries the action until it fails or until the timeout is exceeded.

waitWhile' :: SessionState m => Int -> Double -> m a -> m ()Source

Like waitUntil', but retries the action until it either fails or until the timeout is exceeded.

Expected conditions

data ExpectFailed Source

An exception representing the failure of an expected condition.

expect :: MonadBaseControl IO m => Bool -> m ()Source

An expected condition. This function allows you to express assertions in your explicit wait. This function raises ExpectFailed if the given boolean is False, and otherwise does nothing.

unexpected :: MonadBaseControl IO m => m aSource

throws ExpectFailed. This is nice for writing your own abstractions.

Convenience functions

expectAny :: MonadBaseControl IO m => (a -> m Bool) -> [a] -> m ()Source

Apply a predicate to every element in a list, and expect that at least one succeeds.

expectAll :: MonadBaseControl IO m => (a -> m Bool) -> [a] -> m ()Source

Apply a predicate to every element in a list, and expect that all succeed.

(<||>) :: Monad m => m Bool -> m Bool -> m BoolSource

Lifted boolean or

(<&&>) :: Monad m => m Bool -> m Bool -> m BoolSource

Lifted boolean and