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

Safe HaskellNone
LanguageHaskell98

Test.WebDriver.Session

Contents

Synopsis

WDSessionState class

class (Monad m, Applicative m) => WDSessionState m where Source

A class for monads that carry a WebDriver session with them. The MonadBaseControl superclass is used for exception handling through the lifted-base package.

Methods

getSession :: m WDSession Source

Retrieves the current session state of the monad

putSession :: WDSession -> m () Source

Sets a new session state for the monad

type WDSessionStateIO s = (WDSessionState s, MonadBase IO s) Source

Constraint synonym for the common pairing of WDSessionState and MonadBase IO.

type WDSessionStateControl s = (WDSessionState s, MonadBaseControl IO s) Source

Constraint synonym for another common pairing of WDSessionState and MonadBaseControl IO. This is commonly used in library types to indicate use of lifted exception handling.

withSession :: WDSessionStateControl m => WDSession -> m a -> m a Source

Locally sets a session state for use within the given action. The state of any outside action is unaffected by this function. This function is useful if you need to work with multiple sessions simultaneously.

WebDriver sessions

data WDSession Source

The local state of a WebDriver session. This structure is passed implicitly through all WD computations

Constructors

WDSession 

Fields

wdSessHost :: ByteString
 
wdSessPort :: Int
 
wdSessBasePath :: ByteString
 
wdSessId :: Maybe SessionId

An opaque reference identifying the session to use with WD commands. A value of Nothing indicates that a session hasn't been created yet. Sessions can be created within WD via createSession, or created automatically with runSession

wdSessHist :: [SessionHistory]

The complete history of HTTP requests and responses, most recent first.

wdSessHistUpdate :: SessionHistoryConfig

Update function used to append new entries to session history

wdSessHTTPManager :: Manager

HTTP Manager used for connection pooling by the http-client library.

wdSessHTTPRetryCount :: Int

Number of times to retry a HTTP request if it times out

mkSession :: MonadBase IO m => WDConfig -> m WDSession Source

Constructs a new WDSession from a given WDConfig

mostRecentHistory :: WDSession -> Maybe SessionHistory Source

The most recent SessionHistory entry recorded by this session, if any.

mostRecentHTTPRequest :: WDSession -> Maybe Request Source

The most recent HTTP request issued by this session, if any.

newtype SessionId Source

An opaque identifier for a WebDriver session. These handles are produced by the server on session creation, and act to identify a session in progress.

Constructors

SessionId Text 

SessionHistoryConfig options

type SessionHistoryConfig = SessionHistory -> [SessionHistory] -> [SessionHistory] Source

A function used by wdHistoryConfig to append new entries to session history.

noHistory :: SessionHistoryConfig Source

No session history is saved.

onlyMostRecentHistory :: SessionHistoryConfig Source

Saves only the most recent history