module Test.WebDriver
(
WD(..), WDSession(..), defaultSession, SessionId(..)
, module Test.WebDriver
, Capabilities(..), defaultCaps, allCaps
, Platform(..), ProxyType(..)
, Browser(..), firefox, chrome, ie, opera, iPhone, iPad, android
, module Test.WebDriver.Commands
, InvalidURL(..), NoSessionId(..), BadJSON(..)
, HTTPStatusUnknown(..), HTTPConnError(..)
, UnknownCommand(..), ServerError(..)
, FailedCommand(..), FailedCommandType(..)
, FailedCommandInfo(..), StackFrame(..)
, mkFailedCommandInfo, failedCommand
) where
import Test.WebDriver.Types
import Test.WebDriver.Commands
import Control.Applicative
import Control.Monad.State.Strict
import Control.Exception.Lifted
import Prelude hiding (catch)
runWD :: WDSession -> WD a -> IO a
runWD sess (WD wd) = evalStateT wd sess
runSession :: WDSession -> Capabilities -> WD a -> IO a
runSession s caps wd = runWD s $ createSession caps >> wd <* closeSession
withSession :: WDSession -> WD a -> WD a
withSession s' (WD wd) = WD . lift $ evalStateT wd s'
finallyClose:: WD a -> WD a
finallyClose wd = closeOnException wd <* closeSession
closeOnException :: WD a -> WD a
closeOnException wd = wd `onException` closeSession