webdriver-0.10.0.0: a Haskell client for the Selenium WebDriver protocol
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.WebDriver.Monad

Synopsis

Documentation

newtype WD a Source #

A state monad for WebDriver commands.

Constructors

WD (StateT WDSession IO a) 

Instances

Instances details
MonadFix WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

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

MonadIO WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

liftIO :: IO a -> WD a #

Applicative WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

pure :: a -> WD a #

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

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

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

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

Functor WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

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

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

Monad WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

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

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

return :: a -> WD a #

MonadCatch WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

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

MonadMask WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

mask :: ((forall a. WD a -> WD a) -> WD b) -> WD b #

uninterruptibleMask :: ((forall a. WD a -> WD a) -> WD b) -> WD b #

generalBracket :: WD a -> (a -> ExitCase b -> WD c) -> (a -> WD b) -> WD (b, c) #

MonadThrow WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

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

WebDriver WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

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

WDSessionState WD Source # 
Instance details

Defined in Test.WebDriver.Monad

MonadBaseControl IO WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Associated Types

type StM WD a #

Methods

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

restoreM :: StM WD a -> WD a #

MonadBase IO WD Source # 
Instance details

Defined in Test.WebDriver.Monad

Methods

liftBase :: IO α -> WD α #

type StM WD a Source # 
Instance details

Defined in Test.WebDriver.Monad

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.