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

Safe HaskellNone
LanguageHaskell2010

Test.WebDriver.Monad

Synopsis

Documentation

newtype WD a Source #

A state monad for WebDriver commands.

Constructors

WD (StateT WDSession IO a) 

Instances

Monad WD Source # 

Methods

(>>=) :: WD a -> (a -> WD b) -> WD b #

(>>) :: WD a -> WD b -> WD b #

return :: a -> WD a #

fail :: String -> WD a #

Functor WD Source # 

Methods

fmap :: (a -> b) -> WD a -> WD b #

(<$) :: a -> WD b -> WD a #

MonadFix WD Source # 

Methods

mfix :: (a -> WD a) -> WD a #

Applicative WD Source # 

Methods

pure :: a -> WD a #

(<*>) :: WD (a -> b) -> WD a -> WD b #

(*>) :: WD a -> WD b -> WD b #

(<*) :: WD a -> WD b -> WD a #

MonadIO WD Source # 

Methods

liftIO :: IO a -> WD a #

MonadThrow WD Source # 

Methods

throwM :: Exception e => e -> WD a #

MonadCatch WD Source # 

Methods

catch :: Exception e => WD a -> (e -> WD a) -> WD a #

WDSessionState WD Source # 
WebDriver WD Source # 

Methods

doCommand :: (ToJSON a, FromJSON b) => Method -> Text -> a -> WD b Source #

MonadBase IO WD Source # 

Methods

liftBase :: IO α -> WD α #

MonadBaseControl IO WD Source # 

Associated Types

type StM (WD :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase WD IO -> IO a) -> WD a #

restoreM :: StM WD a -> WD a #

type StM WD a Source # 
type StM WD a = StM (StateT WDSession IO) a

runWD :: WDSession -> WD a -> IO a Source #

Executes a WD computation within the IO monad, using the given WDSession as state for WebDriver requests.

runSession :: WebDriverConfig conf => conf -> WD a -> IO a Source #

Executes a WD computation within the IO monad, automatically creating a new session beforehand.

NOTE: session is not automatically closed when complete. If you want this behavior, use finallyClose. Example:

   runSessionThenClose action = runSession myConfig . finallyClose $ action

finallyClose :: WebDriver wd => wd a -> wd a Source #

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 a Source #

Exception handler that closes the session when an asynchronous exception is thrown, but otherwise leaves the session open if the action was successful.

getSessionHistory :: WDSessionState wd => wd [SessionHistory] Source #

Gets the command history for the current session.

dumpSessionHistory :: WDSessionStateControl wd => wd a -> wd a Source #

Prints a history of API requests to stdout after computing the given action.