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

Safe HaskellNone

Test.WebDriver.Monad

Synopsis

Documentation

newtype WD a Source

A monadic interface to the WebDriver server. This monad is simply a state monad transformer over IO, threading session information between sequential webdriver commands

Constructors

WD (StateT WDSession IO a) 

runWD :: WDSession -> WD a -> IO aSource

Executes a WD computation within the IO monad, using the given WDSession.

runSession :: WDSession -> Capabilities -> WD a -> IO aSource

Like runWD, but automatically creates a session beforehand and closes it afterwards. This is a very common use case.

withSession :: WDSession -> WD a -> WD aSource

Locally sets a WDSession for use within the given WD action. The state of the outer action is unaffected by this function. This function is useful if you need to work with multiple sessions at once.

finallyClose :: WebDriver wd => wd a -> wd aSource

A finalizer ensuring that the session is always closed at the end of the given WD action, regardless of any exceptions.

closeOnException :: WebDriver wd => wd a -> wd aSource

A variant of finallyClose that only closes the session when an asynchronous exception is thrown, but otherwise leaves the session open if the action was successful.