-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | a Haskell client for the Selenium WebDriver protocol
--
-- A Selenium WebDriver client for the Haskell programming language. You
-- can use it to automate browser sessions for testing, system
-- administration, etc. For more information about Selenium itself, see
-- http://seleniumhq.org/
@package webdriver
@version 0.0.1
module Test.WebDriver.Chrome.Extension
-- | An opaque type representing a Google Chrome extension.
data ChromeExtension
-- | Load a .crx file as a ChromeExtension
loadExtension :: MonadIO m => FilePath -> m ChromeExtension
-- | Load raw .crx data as a ChromeExtension
loadRawExtension :: ByteString -> ChromeExtension
instance Eq ChromeExtension
instance Show ChromeExtension
instance Read ChromeExtension
instance ToJSON ChromeExtension
instance FromJSON ChromeExtension
-- | A module for working with Firefox profiles. Firefox profiles are
-- manipulated in pure code and then "prepared" for network transmission.
module Test.WebDriver.Firefox.Profile
-- | A pure representation of a FirefoxProfile. This structure allows you
-- to construct and manipulate Firefox profiles in pure code, deferring
-- execution of IO operations until the profile is "prepared" using
-- either prepareProfile or one of the wrapper functions
-- prepareTempProfile and prepareLoadedProfile.
data FirefoxProfile
FirefoxProfile :: FilePath -> HashSet FilePath -> HashMap Text FirefoxPref -> FirefoxProfile
-- | Location of the profile in the file system
profileDir :: FirefoxProfile -> FilePath
-- | A set of filepaths pointing to Firefox extensions. These paths can
-- either refer to an .xpi file or an extension directory
profileExts :: FirefoxProfile -> HashSet FilePath
-- | A map of Firefox preferences. These are the settings found in the
-- profile's prefs.js, and entries found in about:config
profilePrefs :: FirefoxProfile -> HashMap Text FirefoxPref
-- | Represents a Firefox profile that has been prepared for network
-- transmission. The profile cannot be modified in this form.
data PreparedFirefoxProfile
-- | A Firefox preference. This is the subset of JSON values that excludes
-- arrays and objects.
data FirefoxPref
PrefInteger :: !Integer -> FirefoxPref
PrefDouble :: !Double -> FirefoxPref
PrefString :: !Text -> FirefoxPref
PrefBool :: !Bool -> FirefoxPref
-- | A typeclass to convert types to Firefox preference values
class ToFirefox a
toFirefox :: ToFirefox a => a -> FirefoxPref
-- | Add a new preference entry to a profile, overwriting any existing
-- entry with the same key.
addPref :: ToFirefox a => Text -> a -> FirefoxProfile -> FirefoxProfile
-- | Retrieve a preference from a profile by key name.
getPref :: Text -> FirefoxProfile -> Maybe FirefoxPref
-- | Delete an existing preference entry from a profile. This operation is
-- silent if the preference wasn't found.
deletePref :: Text -> FirefoxProfile -> FirefoxProfile
-- | Add a new extension to the profile. The file path should refer to an
-- .xpi file or an extension directory. This operation has no effect if
-- the same extension has already been added to this profile.
addExtension :: FilePath -> FirefoxProfile -> FirefoxProfile
-- | Delete an existing extension from the profile. The file path should
-- refer to an .xpi file or an extension directory. This operation has no
-- effect if the extension was never added to the profile.
deleteExtension :: FilePath -> FirefoxProfile -> FirefoxProfile
-- | Load an existing profile from the file system. Any prepared changes
-- made to the FirefoxProfile will have no effect to the profile on disk.
loadProfile :: MonadIO m => FilePath -> m FirefoxProfile
-- | Prepare a FirefoxProfile for network transmission.
--
-- Internally, this function constructs a Firefox profile within a temp
-- directory, archives it as a zip file, and then base64 encodes the
-- zipped data. The temporary directory is deleted afterwards
prepareProfile :: MonadIO m => FirefoxProfile -> m PreparedFirefoxProfile
-- | Apply a function on an automatically generated default profile, and
-- prepare the result. The FirefoxProfile passed to the handler function
-- is the same one used by sessions when no Firefox profile is specified
prepareTempProfile :: MonadIO m => (FirefoxProfile -> FirefoxProfile) -> m PreparedFirefoxProfile
-- | Convenience function to load an existing Firefox profile from disk,
-- apply a handler function, and then prepare the result for network
-- transmission.
prepareLoadedProfile :: MonadIO m => FilePath -> (FirefoxProfile -> FirefoxProfile) -> m PreparedFirefoxProfile
instance Typeable ProfileParseError
instance Eq FirefoxPref
instance Show FirefoxPref
instance Eq FirefoxProfile
instance Show FirefoxProfile
instance Eq PreparedFirefoxProfile
instance Show PreparedFirefoxProfile
instance ToJSON PreparedFirefoxProfile
instance FromJSON PreparedFirefoxProfile
instance Eq ProfileParseError
instance Show ProfileParseError
instance Read ProfileParseError
instance HasResolution r => ToFirefox (Fixed r)
instance Integral a => ToFirefox (Ratio a)
instance ToFirefox Float
instance ToFirefox Double
instance ToFirefox Word64
instance ToFirefox Word32
instance ToFirefox Word16
instance ToFirefox Word8
instance ToFirefox Word
instance ToFirefox Int64
instance ToFirefox Int32
instance ToFirefox Int16
instance ToFirefox Int8
instance ToFirefox Int
instance ToFirefox Integer
instance ToFirefox Bool
instance ToFirefox String
instance ToFirefox Text
instance Exception ProfileParseError
instance ToJSON FirefoxPref
module Test.WebDriver.Types
-- | A monadic interface to the WebDriver server. This monad is a simple,
-- strict wrapper over IO, threading session information between
-- sequential commands
newtype WD a
WD :: (StateT WDSession IO a) -> WD a
-- | Information about a WebDriver session. This structure is passed
-- implicitly through all WD computations, and is also used to
-- configure the WD monad before execution.
data WDSession
WDSession :: String -> Word16 -> Maybe SessionId -> WDSession
-- | Host name of the WebDriver server for this session
wdHost :: WDSession -> String
-- | Port number of the server
wdPort :: WDSession -> Word16
-- | An opaque reference identifying the session. A value of Nothing
-- indicates that a session hasn't been created yet. To create new
-- sessions, use the createSession and runSession
-- functions.
wdSessId :: WDSession -> Maybe SessionId
-- | A default session connects to localhost on port 4444, and hasn't been
-- created yet. This value is the same as the def with a more
-- specific type.
defaultSession :: WDSession
-- | 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.
newtype SessionId
SessionId :: Text -> SessionId
-- | A structure describing the capabilities of a session. This record
-- serves dual roles.
--
--
-- - It's used to specify the desired capabilities for a session before
-- it's created. In this usage, fields that are set to Nothing indicate
-- that we have no preference for that capability.
-- - When returned by getCaps, it's used to describe the actual
-- capabilities given to us by the WebDriver server. Here a value of
-- Nothing indicates that the server doesn't support the capability.
-- Thus, for Maybe Bool fields, both Nothing and Just False indicate a
-- lack of support for the desired capability.
--
data Capabilities
Capabilities :: Browser -> Maybe String -> Platform -> ProxyType -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Capabilities
-- | Browser choice and browser specific settings.
browser :: Capabilities -> Browser
-- | Browser version to use.
version :: Capabilities -> Maybe String
-- | Platform on which the browser should/will run.
platform :: Capabilities -> Platform
-- | Proxy configuration.
proxy :: Capabilities -> ProxyType
javascriptEnabled :: Capabilities -> Maybe Bool
takesScreenshot :: Capabilities -> Maybe Bool
handlesAlerts :: Capabilities -> Maybe Bool
databaseEnabled :: Capabilities -> Maybe Bool
locationContextEnabled :: Capabilities -> Maybe Bool
applicationCacheEnabled :: Capabilities -> Maybe Bool
browserConnectionEnabled :: Capabilities -> Maybe Bool
cssSelectorsEnabled :: Capabilities -> Maybe Bool
webStorageEnabled :: Capabilities -> Maybe Bool
rotatable :: Capabilities -> Maybe Bool
acceptSSLCerts :: Capabilities -> Maybe Bool
nativeEvents :: Capabilities -> Maybe Bool
-- | Default capabilities. This is the same as the Default instance,
-- but with a more specific type. By default we use Firefox of an
-- unspecified version with default settings on whatever platform is
-- available. All Maybe Bool capabilities are set to Nothing (no
-- preference).
defaultCaps :: Capabilities
-- | Same as defaultCaps, but with all Maybe Bool capabilities set
-- to Just True.
allCaps :: Capabilities
-- | Represents platform options supported by WebDriver. The value Any
-- represents no preference.
data Platform
Windows :: Platform
XP :: Platform
Vista :: Platform
Mac :: Platform
Linux :: Platform
Unix :: Platform
Any :: Platform
-- | Available settings for the proxy Capabilities field
data ProxyType
NoProxy :: ProxyType
UseSystemSettings :: ProxyType
AutoDetect :: ProxyType
-- | Use a proxy auto-config file specified by URL
PAC :: String -> ProxyType
autoConfigUrl :: ProxyType -> String
-- | Manually specify proxy hosts as hostname:port strings. Note that
-- behavior is undefined for empty strings.
Manual :: String -> String -> String -> ProxyType
ftpProxy :: ProxyType -> String
sslProxy :: ProxyType -> String
httpProxy :: ProxyType -> String
-- | Browser setting and browser-specific capabilities.
data Browser
Firefox :: Maybe PreparedFirefoxProfile -> Maybe FFLogPref -> Maybe FilePath -> Browser
-- | The firefox profile to use. If Nothing, a a default temporary profile
-- is automatically created and used.
ffProfile :: Browser -> Maybe PreparedFirefoxProfile
-- | Firefox logging preference
ffLogPref :: Browser -> Maybe FFLogPref
-- | Path to Firefox binary. If Nothing, use a sensible system-based
-- default.
ffBinary :: Browser -> Maybe FilePath
Chrome :: Maybe String -> Maybe FilePath -> [String] -> [ChromeExtension] -> Browser
chromeDriverVersion :: Browser -> Maybe String
-- | Path to Chrome binary. If Nothing, use a sensible system-based
-- default.
chromeBinary :: Browser -> Maybe FilePath
-- | A list of command-line options to pass to the Chrome binary.
chromeOptions :: Browser -> [String]
-- | A list of extensions to use.
chromeExtensions :: Browser -> [ChromeExtension]
IE :: Bool -> Browser
ignoreProtectedModeSettings :: Browser -> Bool
-- | Opera-specific configuration coming soon!
Opera :: Browser
HTMLUnit :: Browser
IPhone :: Browser
IPad :: Browser
Android :: Browser
-- | Default Firefox settings. All fields are set to Nothing.
firefox :: Browser
-- | Default Chrome settings. All Maybe fields are set to Nothing, no
-- options are specified, and no extensions are used.
chrome :: Browser
-- | Default IE settings. ignoreProtectedModeSettings is set to
-- True.
ie :: Browser
opera :: Browser
iPhone :: Browser
iPad :: Browser
android :: Browser
-- | An opaque identifier for a web page element.
newtype Element
Element :: Text -> Element
-- | An opaque identifier for a browser window
newtype WindowHandle
WindowHandle :: Text -> WindowHandle
-- | A special WindowHandle that always refers to the currently
-- focused window.
currentWindow :: WindowHandle
-- | Cookies are delicious delicacies.
data Cookie
Cookie :: Text -> Text -> Maybe Text -> Maybe Text -> Maybe Bool -> Maybe Integer -> Cookie
cookName :: Cookie -> Text
cookValue :: Cookie -> Text
cookPath :: Cookie -> Maybe Text
cookDomain :: Cookie -> Maybe Text
cookSecure :: Cookie -> Maybe Bool
cookExpiry :: Cookie -> Maybe Integer
-- | A screen orientation
data Orientation
Landscape :: Orientation
Portrait :: Orientation
-- | A mouse button
data MouseButton
LeftButton :: MouseButton
MiddleButton :: MouseButton
RightButton :: MouseButton
-- | Specifies element(s) within a DOM tree using various selection
-- methods.
data Selector
ById :: Text -> Selector
ByName :: Text -> Selector
-- | (Note: multiple classes are not allowed. For more control, use ByCSS)
ByClass :: Text -> Selector
ByTag :: Text -> Selector
ByLinkText :: Text -> Selector
ByPartialLinkText :: Text -> Selector
ByCSS :: Text -> Selector
ByXPath :: Text -> Selector
-- | An existential wrapper for any ToJSON instance. This allows us
-- to pass parameters of many different types to Javascript code.
data JSArg
JSArg :: a -> JSArg
-- | An invalid URL was given
newtype InvalidURL
InvalidURL :: String -> InvalidURL
-- | A command requiring a session ID was attempted when no session ID was
-- available.
newtype NoSessionId
NoSessionId :: String -> NoSessionId
-- | An error occured when parsing a JSON value.
newtype BadJSON
BadJSON :: String -> BadJSON
-- | An unexpected HTTP status was sent by the server.
data HTTPStatusUnknown
HTTPStatusUnknown :: (Int, Int, Int) -> String -> HTTPStatusUnknown
-- | HTTP connection errors.
newtype HTTPConnError
HTTPConnError :: ConnError -> HTTPConnError
-- | A command was sent to the WebDriver server that it didn't recognize.
newtype UnknownCommand
UnknownCommand :: String -> UnknownCommand
-- | A server-side exception occured
newtype ServerError
ServerError :: String -> ServerError
-- | This exception encapsulates many different kinds of exceptions that
-- can occur when a command fails.
data FailedCommand
FailedCommand :: FailedCommandType -> FailedCommandInfo -> FailedCommand
-- | The type of failed command exception that occured.
data FailedCommandType
NoSuchElement :: FailedCommandType
NoSuchFrame :: FailedCommandType
UnknownFrame :: FailedCommandType
StaleElementReference :: FailedCommandType
ElementNotVisible :: FailedCommandType
InvalidElementState :: FailedCommandType
UnknownError :: FailedCommandType
ElementIsNotSelectable :: FailedCommandType
JavascriptError :: FailedCommandType
XPathLookupError :: FailedCommandType
Timeout :: FailedCommandType
NoSuchWindow :: FailedCommandType
InvalidCookieDomain :: FailedCommandType
UnableToSetCookie :: FailedCommandType
UnexpectedAlertOpen :: FailedCommandType
NoAlertOpen :: FailedCommandType
ScriptTimeout :: FailedCommandType
InvalidElementCoordinates :: FailedCommandType
IMENotAvailable :: FailedCommandType
IMEEngineActivationFailed :: FailedCommandType
InvalidSelector :: FailedCommandType
MoveTargetOutOfBounds :: FailedCommandType
InvalidXPathSelector :: FailedCommandType
InvalidXPathSelectorReturnType :: FailedCommandType
MethodNotAllowed :: FailedCommandType
-- | Detailed information about the failed command provided by the server.
data FailedCommandInfo
FailedCommandInfo :: String -> Maybe SessionId -> Maybe ByteString -> Maybe String -> [StackFrame] -> FailedCommandInfo
errMsg :: FailedCommandInfo -> String
errSessId :: FailedCommandInfo -> Maybe SessionId
errScreen :: FailedCommandInfo -> Maybe ByteString
errClass :: FailedCommandInfo -> Maybe String
errStack :: FailedCommandInfo -> [StackFrame]
-- | An individual stack frame from the stack trace provided by the server
-- during a FailedCommand.
data StackFrame
StackFrame :: String -> String -> String -> Word -> StackFrame
sfFileName :: StackFrame -> String
sfClassName :: StackFrame -> String
sfMethodName :: StackFrame -> String
sfLineNumber :: StackFrame -> Word
-- | Constructs a FailedCommandInfo from only an error message.
mkFailedCommandInfo :: String -> FailedCommandInfo
-- | Convenience function to throw a FailedCommand locally with no
-- server-side info present.
failedCommand :: FailedCommandType -> String -> WD a
instance ToJSON JSArg
instance ToJSON Selector
instance ToJSON ProxyType
instance FromJSON ProxyType
instance FromJSON MouseButton
instance ToJSON MouseButton
instance FromJSON Orientation
instance ToJSON Orientation
instance FromJSON Platform
instance ToJSON Platform
instance FromJSON Browser
instance ToJSON Browser
instance FromJSON Cookie
instance FromJSON FFLogPref
instance ToJSON FFLogPref
instance ToJSON Cookie
instance Typeable InvalidURL
instance Typeable NoSessionId
instance Typeable BadJSON
instance Typeable HTTPStatusUnknown
instance Typeable HTTPConnError
instance Typeable UnknownCommand
instance Typeable ServerError
instance Typeable FailedCommand
instance Eq SessionId
instance Ord SessionId
instance Show SessionId
instance Read SessionId
instance FromJSON SessionId
instance ToJSON SessionId
instance Eq WindowHandle
instance Ord WindowHandle
instance Show WindowHandle
instance Read WindowHandle
instance FromJSON WindowHandle
instance ToJSON WindowHandle
instance Eq Element
instance Ord Element
instance Show Element
instance Read Element
instance Eq WDSession
instance Show WDSession
instance Functor WD
instance Monad WD
instance MonadState WDSession WD
instance MonadIO WD
instance Applicative WD
instance Eq Platform
instance Show Platform
instance Ord Platform
instance Bounded Platform
instance Enum Platform
instance Eq ProxyType
instance Show ProxyType
instance Eq FFLogPref
instance Show FFLogPref
instance Ord FFLogPref
instance Bounded FFLogPref
instance Enum FFLogPref
instance Eq Browser
instance Show Browser
instance Eq Capabilities
instance Show Capabilities
instance Eq InvalidURL
instance Show InvalidURL
instance Eq NoSessionId
instance Show NoSessionId
instance Eq BadJSON
instance Show BadJSON
instance Eq HTTPStatusUnknown
instance Show HTTPStatusUnknown
instance Eq HTTPConnError
instance Show HTTPConnError
instance Eq UnknownCommand
instance Show UnknownCommand
instance Eq ServerError
instance Show ServerError
instance Eq FailedCommandType
instance Ord FailedCommandType
instance Enum FailedCommandType
instance Bounded FailedCommandType
instance Show FailedCommandType
instance Show StackFrame
instance Eq StackFrame
instance Eq FailedCommandInfo
instance Eq FailedCommand
instance Show FailedCommand
instance Eq Cookie
instance Show Cookie
instance Eq Selector
instance Show Selector
instance Ord Selector
instance Eq Orientation
instance Show Orientation
instance Ord Orientation
instance Bounded Orientation
instance Enum Orientation
instance Eq MouseButton
instance Show MouseButton
instance Ord MouseButton
instance Bounded MouseButton
instance Enum MouseButton
instance FromJSON StackFrame
instance FromJSON FailedCommandInfo
instance FromJSON Capabilities
instance ToJSON Capabilities
instance ToJSON Element
instance FromJSON Element
instance Show FailedCommandInfo
instance Exception FailedCommand
instance Exception ServerError
instance Exception UnknownCommand
instance Exception HTTPConnError
instance Exception HTTPStatusUnknown
instance Exception BadJSON
instance Exception NoSessionId
instance Exception InvalidURL
instance Default Capabilities
instance Default WDSession
instance MonadBaseControl IO WD
instance MonadBase IO WD
-- | A collection of convenience functions for using and parsing JSON valus
-- within WD. All monadic parse errors are converted to
-- asynchronous BadJSON exceptions.
module Test.WebDriver.JSON
-- | This operator is a wrapper over Aeson's .: operator.
(!:) :: FromJSON a => Object -> Text -> WD a
-- | Parse a lazy ByteString as a top-level JSON Value, then
-- convert it to an instance of FromJSON..
parseJSON' :: FromJSON a => ByteString -> WD a
-- | Convert a JSON Value to an instance of FromJSON.
fromJSON' :: FromJSON a => Value -> WD a
-- | Construct a singleton JSON object from a key and value.
single :: ToJSON a => Text -> a -> Value
-- | Construct a 2-element JSON object from a pair of keys and a
-- pair of values.
pair :: (ToJSON a, ToJSON b) => (Text, Text) -> (a, b) -> Value
-- | Construct a 3-element JSON object from a triple of keys and a
-- triple of values.
triple :: (ToJSON a, ToJSON b, ToJSON c) => (Text, Text, Text) -> (a, b, c) -> Value
-- | Parse a JSON Object as a pair. The first two string arguments
-- specify the keys to extract from the object. The fourth string is the
-- name of the calling function, for better error reporting.
parsePair :: (FromJSON a, FromJSON b) => String -> String -> String -> Value -> WD (a, b)
-- | Parse a JSON Object as a triple. The first three string arguments
-- specify the keys to extract from the object. The fourth string is the
-- name of the calling function, for better error reporting.
parseTriple :: (FromJSON a, FromJSON b, FromJSON c) => String -> String -> String -> String -> Value -> WD (a, b, c)
-- | Convert an attoparsec parser result to WD.
apResultToWD :: FromJSON a => Result Value -> WD a
-- | Convert an Aeson parser result to WD.
aesonResultToWD :: Result a -> WD a
module Test.WebDriver.Commands.Wait
-- | An exception representing a failure of an expected condition.
data ExpectFailed
-- | An expected condition. This function allows you to express assertions
-- in your explicit wait. This function raises ExpectFailed if the
-- given boolean is False, and otherwise does nothing.
expect :: Bool -> WD ()
-- | Raises ExpectFailed.
unexpected :: WD a
expectAny :: (a -> WD Bool) -> [a] -> WD ()
expectAll :: (a -> WD Bool) -> [a] -> WD ()
-- | Lifted boolean or
(<||>) :: Monad m => m Bool -> m Bool -> m Bool
-- | Lifted boolean and
(<&&>) :: Monad m => m Bool -> m Bool -> m Bool
-- | Wait until either the given action succeeds or the timeout is reached.
-- The action will be retried every .25 seconds until no ExpectFailed or
-- NoSuchElement exceptions occur. The timeout value is expressed in
-- seconds.
waitUntil :: Double -> WD a -> WD a
-- | Similar to waitUntil but allows you to also specify the poll frequency
-- of the WD action. The frequency is expressed as an integer in
-- microseconds.
waitUntil' :: Int -> Double -> WD a -> WD a
-- | Like waitWhile, but retries the action until it fails or until the
-- timeout is exceeded.
waitWhile :: Double -> WD a -> WD ()
-- | Like waitWhile', but retries the action until it either fails or until
-- the timeout is exceeded.
waitWhile' :: Int -> Double -> WD a -> WD ()
instance Typeable ExpectFailed
instance Show ExpectFailed
instance Eq ExpectFailed
instance Exception ExpectFailed
module Test.WebDriver.Commands.Internal
-- | The HTTP request method, to be used in the Request object. We
-- are missing a few of the stranger methods, but these are not really
-- necessary until we add full TLS.
data RequestMethod :: *
HEAD :: RequestMethod
PUT :: RequestMethod
GET :: RequestMethod
POST :: RequestMethod
DELETE :: RequestMethod
OPTIONS :: RequestMethod
TRACE :: RequestMethod
CONNECT :: RequestMethod
Custom :: String -> RequestMethod
-- | The Header data type pairs header names & values.
data Header :: *
Header :: HeaderName -> String -> Header
doCommand :: (ToJSON a, FromJSON b) => RequestMethod -> Text -> a -> WD b
doSessCommand :: (ToJSON a, FromJSON b) => RequestMethod -> Text -> a -> WD b
doElemCommand :: (ToJSON a, FromJSON b) => RequestMethod -> Element -> Text -> a -> WD b
doWinCommand :: (ToJSON a, FromJSON b) => RequestMethod -> WindowHandle -> Text -> a -> WD b
doCommand' :: (ToJSON a, FromJSON b) => [Header] -> RequestMethod -> Text -> a -> WD b
doSessCommand' :: (ToJSON a, FromJSON b) => [Header] -> RequestMethod -> Text -> a -> WD b
doWinCommand' :: (ToJSON a, FromJSON b) => [Header] -> RequestMethod -> WindowHandle -> Text -> a -> WD b
doElemCommand' :: (ToJSON a, FromJSON b) => [Header] -> RequestMethod -> Element -> Text -> a -> WD b
-- | This module exports basic WD actions that can be used to interact with
-- a browser session.
module Test.WebDriver.Commands
-- | Create a new session with the given Capabilities. This command
-- resets the current session ID to that of the new session.
createSession :: Capabilities -> WD WDSession
-- | Close the current session and the browser associated with it.
closeSession :: WD ()
-- | Retrieve a list of active sessions and their Capabilities.
sessions :: WD [(SessionId, Capabilities)]
-- | Get the actual Capabilities of the current session.
getCaps :: WD Capabilities
-- | Opens a new page by the given URL.
openPage :: String -> WD ()
-- | Navigate forward in the browser history.
forward :: WD ()
-- | Navigate backward in the browser history.
back :: WD ()
-- | Refresh the current page
refresh :: WD ()
-- | Gets the URL of the current page.
getCurrentURL :: WD String
-- | Get the current page source
getSource :: WD Text
-- | Get the title of the current page.
getTitle :: WD Text
-- | Grab a screenshot of the current page as a PNG image
screenshot :: WD ByteString
-- | Sets the amount of time we implicitly wait when searching for
-- Elements.
setImplicitWait :: Integer -> WD ()
-- | Sets the amount of time we wait for an asynchronous script to return a
-- result
setScriptTimeout :: Integer -> WD ()
-- | An opaque identifier for a web page element.
newtype Element
Element :: Text -> Element
-- | Specifies element(s) within a DOM tree using various selection
-- methods.
data Selector
ById :: Text -> Selector
ByName :: Text -> Selector
-- | (Note: multiple classes are not allowed. For more control, use ByCSS)
ByClass :: Text -> Selector
ByTag :: Text -> Selector
ByLinkText :: Text -> Selector
ByPartialLinkText :: Text -> Selector
ByCSS :: Text -> Selector
ByXPath :: Text -> Selector
-- | Find an element on the page using the given element selector.
findElem :: Selector -> WD Element
-- | Find all elements on the page matching the given selector.
findElems :: Selector -> WD [Element]
-- | Search for an element using the given element as root.
findElemFrom :: Element -> Selector -> WD Element
-- | Find all elements matching a selector, using the given element as
-- root.
findElemsFrom :: Element -> Selector -> WD [Element]
-- | Click on an element.
click :: Element -> WD ()
-- | Submit a form element. This may be applied to descendents of a form
-- element as well.
submit :: Element -> WD ()
-- | Get all visible text within this element.
getText :: Element -> WD Text
-- | Send a sequence of keystrokes to an element. All modifier keys are
-- released at the end of the function. For more information about
-- modifier keys, see
-- http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value
sendKeys :: Text -> Element -> WD ()
-- | Similar to sendKeys, but doesn't implicitly release modifier keys
-- afterwards. This allows you to combine modifiers with mouse clicks.
sendRawKeys :: Text -> Element -> WD ()
-- | Clear a textarea or text input element's value.
clearInput :: Element -> WD ()
-- | Retrieve the value of an element's attribute
attr :: Element -> Text -> WD (Maybe Text)
-- | Retrieve the value of an element's computed CSS property
cssProp :: Element -> Text -> WD (Maybe Text)
-- | Retrieve an element's current position.
elemPos :: Element -> WD (Int, Int)
-- | Retrieve an element's current size.
elemSize :: Element -> WD (Word, Word)
-- | Determine if the element is selected.
isSelected :: Element -> WD Bool
-- | Determine if the element is enabled.
isEnabled :: Element -> WD Bool
-- | Determine if the element is displayed.
isDisplayed :: Element -> WD Bool
-- | Return the tag name of the given element.
tagName :: Element -> WD Text
-- | Return the element that currently has focus.
activeElem :: WD Element
-- | Describe the element. Returns a JSON object whose meaning is currently
-- undefined by the WebDriver protocol.
elemInfo :: Element -> WD Value
-- | Determines if two element identifiers refer to the same element.
(<==>) :: Element -> Element -> WD Bool
-- | Determines if two element identifiers refer to different elements.
(=>) :: Element -> Element -> WD Bool
-- | Inject a snippet of Javascript into the page for execution in the
-- context of the currently selected frame. The executed script is
-- assumed to be synchronous and the result of evaluating the script is
-- returned and converted to an instance of FromJSON.
--
-- The first parameter defines arguments to pass to the javascript
-- function. Arguments of type Element will be converted to the
-- corresponding DOM element. Likewise, any elements in the script result
-- will be returned to the client as Elements.
--
-- The second parameter defines the script itself in the form of a
-- function body. The value returned by that function will be returned to
-- the client. The function will be invoked with the provided argument
-- list and the values may be accessed via the arguments object in the
-- order specified.
executeJS :: FromJSON a => [JSArg] -> Text -> WD a
-- | Executes a snippet of Javascript code asynchronously. This function
-- works similarly to executeJS, except that the Javascript is
-- passed a callback function as its final argument. The script should
-- call this function to signal that it has finished executing, passing
-- to it a value that will be returned as the result of asyncJS. A result
-- of Nothing indicates that the Javascript function timed out (see
-- setScriptTimeout)
asyncJS :: FromJSON a => [JSArg] -> Text -> WD (Maybe a)
-- | An existential wrapper for any ToJSON instance. This allows us
-- to pass parameters of many different types to Javascript code.
data JSArg
JSArg :: a -> JSArg
-- | An opaque identifier for a browser window
newtype WindowHandle
WindowHandle :: Text -> WindowHandle
-- | A special WindowHandle that always refers to the currently
-- focused window.
currentWindow :: WindowHandle
-- | Returns a handle to the currently focused window
getCurrentWindow :: WD WindowHandle
-- | Switches focus to a given window.
focusWindow :: WindowHandle -> WD ()
-- | Closes the given window
closeWindow :: WindowHandle -> WD ()
-- | Returns a list of all windows available to the session
windows :: WD [WindowHandle]
-- | Get the dimensions of the given window.
getWindowSize :: WindowHandle -> WD (Word, Word)
-- | Set the dimensions of the given window.
setWindowSize :: WindowHandle -> (Word, Word) -> WD ()
-- | Get the coordinates of the given window.
getWindowPos :: WindowHandle -> WD (Int, Int)
-- | Set the coordinates of the given window.
setWindowPos :: WindowHandle -> (Int, Int) -> WD ()
-- | Cookies are delicious delicacies.
data Cookie
Cookie :: Text -> Text -> Maybe Text -> Maybe Text -> Maybe Bool -> Maybe Integer -> Cookie
cookName :: Cookie -> Text
cookValue :: Cookie -> Text
cookPath :: Cookie -> Maybe Text
cookDomain :: Cookie -> Maybe Text
cookSecure :: Cookie -> Maybe Bool
cookExpiry :: Cookie -> Maybe Integer
-- | Retrieve all cookies visible to the current page.
cookies :: WD [Cookie]
-- | Set a cookie. If the cookie path is not specified, it will default to
-- "/". Likewise, if the domain is omitted, it will default to the
-- current page's domain
setCookie :: Cookie -> WD ()
-- | Delete a cookie. This will do nothing is the cookie isn't visible to
-- the current page.
deleteCookie :: Cookie -> WD ()
-- | Delete all visible cookies on the current page.
deleteVisibleCookies :: WD ()
-- | Get the text of an alert dialog.
getAlertText :: WD Text
-- | Sends keystrokes to Javascript prompt() dialog.
replyToAlert :: Text -> WD ()
-- | Accepts the currently displayed alert dialog.
acceptAlert :: WD ()
-- | Dismisses the currently displayed alert dialog.
dismissAlert :: WD ()
-- | Moves the mouse to the given position relative to the active element.
moveTo :: (Int, Int) -> WD ()
-- | Moves the mouse to the center of a given element.
moveToCenter :: Element -> WD ()
-- | Moves the mouse to the given position relative to the given element.
moveToFrom :: (Int, Int) -> Element -> WD ()
-- | Click at the current mouse position with the given mouse button.
clickWith :: MouseButton -> WD ()
-- | A mouse button
data MouseButton
LeftButton :: MouseButton
MiddleButton :: MouseButton
RightButton :: MouseButton
-- | Press and hold the left mouse button down. Note that undefined
-- behavior occurs if the next mouse command is not mouseUp.
mouseDown :: WD ()
-- | Release the left mouse button.
mouseUp :: WD ()
-- | Perform the given action with the left mouse button held down. The
-- mouse is automatically released afterwards.
withMouseDown :: WD a -> WD a
-- | Double click at the current mouse location.
doubleClick :: WD ()
-- | Single tap on the touch screen at the given element's location.
touchClick :: Element -> WD ()
-- | Emulates pressing a finger down on the screen at the given location.
touchDown :: (Int, Int) -> WD ()
-- | Emulates removing a finger from the screen at the given location.
touchUp :: (Int, Int) -> WD ()
-- | Emulates moving a finger on the screen to the given location.
touchMove :: (Int, Int) -> WD ()
-- | Emulate finger-based touch scroll. Use this function if you don't care
-- where the scroll begins
touchScroll :: (Int, Int) -> WD ()
-- | Emulate finger-based touch scroll, starting from the given location
-- relative to the given element.
touchScrollFrom :: (Int, Int) -> Element -> WD ()
-- | Emulate a double click on a touch device.
touchDoubleClick :: Element -> WD ()
-- | Emulate a long click on a touch device.
touchLongClick :: Element -> WD ()
-- | Emulate a flick on the touch screen. The coordinates indicate x and y
-- velocity, respectively. Use this function if you don't care where the
-- flick starts.
touchFlick :: (Int, Int) -> WD ()
-- | Emulate a flick on the touch screen.
touchFlickFrom :: Int -> (Int, Int) -> Element -> WD ()
-- | A screen orientation
data Orientation
Landscape :: Orientation
Portrait :: Orientation
-- | Get the current screen orientation for rotatable display devices.
getOrientation :: WD Orientation
-- | Set the current screen orientation for rotatable display devices.
setOrientation :: Orientation -> WD ()
-- | Get the current geographical location of the device.
getLocation :: WD (Int, Int, Int)
-- | Set the current geographical location of the device.
setLocation :: (Int, Int, Int) -> WD ()
availableIMEEngines :: WD [Text]
activeIMEEngine :: WD Text
checkIMEActive :: WD Bool
activateIME :: Text -> WD ()
deactivateIME :: WD ()
-- | Get information from the server as a JSON Object. For more
-- information about this object see
-- http://code.google.com/p/selenium/wiki/JsonWireProtocol#/status
serverStatus :: WD Value
-- | This module serves as the top-level interface to the Haskell WebDriver
-- bindings, providing most of the functionality you're likely to want.
module Test.WebDriver
-- | A monadic interface to the WebDriver server. This monad is a simple,
-- strict wrapper over IO, threading session information between
-- sequential commands
newtype WD a
WD :: (StateT WDSession IO a) -> WD a
-- | Information about a WebDriver session. This structure is passed
-- implicitly through all WD computations, and is also used to
-- configure the WD monad before execution.
data WDSession
WDSession :: String -> Word16 -> Maybe SessionId -> WDSession
-- | Host name of the WebDriver server for this session
wdHost :: WDSession -> String
-- | Port number of the server
wdPort :: WDSession -> Word16
-- | An opaque reference identifying the session. A value of Nothing
-- indicates that a session hasn't been created yet. To create new
-- sessions, use the createSession and runSession
-- functions.
wdSessId :: WDSession -> Maybe SessionId
-- | A default session connects to localhost on port 4444, and hasn't been
-- created yet. This value is the same as the def with a more
-- specific type.
defaultSession :: WDSession
-- | 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.
newtype SessionId
SessionId :: Text -> SessionId
-- | Executes a WD computation within the IO monad, using the
-- given WDSession.
runWD :: WDSession -> WD a -> IO a
-- | Like runWD, but automatically creates a session beforehand and
-- closes it afterwards. This is a very common use case.
runSession :: WDSession -> Capabilities -> WD a -> IO a
-- | 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.
withSession :: WDSession -> WD a -> WD a
-- | A finalizer ensuring that the session is always closed at the end of
-- the given WD action, regardless of any exceptions.
finallyClose :: WD a -> WD a
-- | 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.
closeOnException :: WD a -> WD a
-- | A structure describing the capabilities of a session. This record
-- serves dual roles.
--
--
-- - It's used to specify the desired capabilities for a session before
-- it's created. In this usage, fields that are set to Nothing indicate
-- that we have no preference for that capability.
-- - When returned by getCaps, it's used to describe the actual
-- capabilities given to us by the WebDriver server. Here a value of
-- Nothing indicates that the server doesn't support the capability.
-- Thus, for Maybe Bool fields, both Nothing and Just False indicate a
-- lack of support for the desired capability.
--
data Capabilities
Capabilities :: Browser -> Maybe String -> Platform -> ProxyType -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Capabilities
-- | Browser choice and browser specific settings.
browser :: Capabilities -> Browser
-- | Browser version to use.
version :: Capabilities -> Maybe String
-- | Platform on which the browser should/will run.
platform :: Capabilities -> Platform
-- | Proxy configuration.
proxy :: Capabilities -> ProxyType
javascriptEnabled :: Capabilities -> Maybe Bool
takesScreenshot :: Capabilities -> Maybe Bool
handlesAlerts :: Capabilities -> Maybe Bool
databaseEnabled :: Capabilities -> Maybe Bool
locationContextEnabled :: Capabilities -> Maybe Bool
applicationCacheEnabled :: Capabilities -> Maybe Bool
browserConnectionEnabled :: Capabilities -> Maybe Bool
cssSelectorsEnabled :: Capabilities -> Maybe Bool
webStorageEnabled :: Capabilities -> Maybe Bool
rotatable :: Capabilities -> Maybe Bool
acceptSSLCerts :: Capabilities -> Maybe Bool
nativeEvents :: Capabilities -> Maybe Bool
-- | Default capabilities. This is the same as the Default instance,
-- but with a more specific type. By default we use Firefox of an
-- unspecified version with default settings on whatever platform is
-- available. All Maybe Bool capabilities are set to Nothing (no
-- preference).
defaultCaps :: Capabilities
-- | Same as defaultCaps, but with all Maybe Bool capabilities set
-- to Just True.
allCaps :: Capabilities
-- | Represents platform options supported by WebDriver. The value Any
-- represents no preference.
data Platform
Windows :: Platform
XP :: Platform
Vista :: Platform
Mac :: Platform
Linux :: Platform
Unix :: Platform
Any :: Platform
-- | Available settings for the proxy Capabilities field
data ProxyType
NoProxy :: ProxyType
UseSystemSettings :: ProxyType
AutoDetect :: ProxyType
-- | Use a proxy auto-config file specified by URL
PAC :: String -> ProxyType
autoConfigUrl :: ProxyType -> String
-- | Manually specify proxy hosts as hostname:port strings. Note that
-- behavior is undefined for empty strings.
Manual :: String -> String -> String -> ProxyType
ftpProxy :: ProxyType -> String
sslProxy :: ProxyType -> String
httpProxy :: ProxyType -> String
-- | Browser setting and browser-specific capabilities.
data Browser
Firefox :: Maybe PreparedFirefoxProfile -> Maybe FFLogPref -> Maybe FilePath -> Browser
-- | The firefox profile to use. If Nothing, a a default temporary profile
-- is automatically created and used.
ffProfile :: Browser -> Maybe PreparedFirefoxProfile
-- | Firefox logging preference
ffLogPref :: Browser -> Maybe FFLogPref
-- | Path to Firefox binary. If Nothing, use a sensible system-based
-- default.
ffBinary :: Browser -> Maybe FilePath
Chrome :: Maybe String -> Maybe FilePath -> [String] -> [ChromeExtension] -> Browser
chromeDriverVersion :: Browser -> Maybe String
-- | Path to Chrome binary. If Nothing, use a sensible system-based
-- default.
chromeBinary :: Browser -> Maybe FilePath
-- | A list of command-line options to pass to the Chrome binary.
chromeOptions :: Browser -> [String]
-- | A list of extensions to use.
chromeExtensions :: Browser -> [ChromeExtension]
IE :: Bool -> Browser
ignoreProtectedModeSettings :: Browser -> Bool
-- | Opera-specific configuration coming soon!
Opera :: Browser
HTMLUnit :: Browser
IPhone :: Browser
IPad :: Browser
Android :: Browser
-- | Default Firefox settings. All fields are set to Nothing.
firefox :: Browser
-- | Default Chrome settings. All Maybe fields are set to Nothing, no
-- options are specified, and no extensions are used.
chrome :: Browser
-- | Default IE settings. ignoreProtectedModeSettings is set to
-- True.
ie :: Browser
opera :: Browser
iPhone :: Browser
iPad :: Browser
android :: Browser
-- | An invalid URL was given
newtype InvalidURL
InvalidURL :: String -> InvalidURL
-- | A command requiring a session ID was attempted when no session ID was
-- available.
newtype NoSessionId
NoSessionId :: String -> NoSessionId
-- | An error occured when parsing a JSON value.
newtype BadJSON
BadJSON :: String -> BadJSON
-- | An unexpected HTTP status was sent by the server.
data HTTPStatusUnknown
HTTPStatusUnknown :: (Int, Int, Int) -> String -> HTTPStatusUnknown
-- | HTTP connection errors.
newtype HTTPConnError
HTTPConnError :: ConnError -> HTTPConnError
-- | A command was sent to the WebDriver server that it didn't recognize.
newtype UnknownCommand
UnknownCommand :: String -> UnknownCommand
-- | A server-side exception occured
newtype ServerError
ServerError :: String -> ServerError
-- | This exception encapsulates many different kinds of exceptions that
-- can occur when a command fails.
data FailedCommand
FailedCommand :: FailedCommandType -> FailedCommandInfo -> FailedCommand
-- | The type of failed command exception that occured.
data FailedCommandType
NoSuchElement :: FailedCommandType
NoSuchFrame :: FailedCommandType
UnknownFrame :: FailedCommandType
StaleElementReference :: FailedCommandType
ElementNotVisible :: FailedCommandType
InvalidElementState :: FailedCommandType
UnknownError :: FailedCommandType
ElementIsNotSelectable :: FailedCommandType
JavascriptError :: FailedCommandType
XPathLookupError :: FailedCommandType
Timeout :: FailedCommandType
NoSuchWindow :: FailedCommandType
InvalidCookieDomain :: FailedCommandType
UnableToSetCookie :: FailedCommandType
UnexpectedAlertOpen :: FailedCommandType
NoAlertOpen :: FailedCommandType
ScriptTimeout :: FailedCommandType
InvalidElementCoordinates :: FailedCommandType
IMENotAvailable :: FailedCommandType
IMEEngineActivationFailed :: FailedCommandType
InvalidSelector :: FailedCommandType
MoveTargetOutOfBounds :: FailedCommandType
InvalidXPathSelector :: FailedCommandType
InvalidXPathSelectorReturnType :: FailedCommandType
MethodNotAllowed :: FailedCommandType
-- | Detailed information about the failed command provided by the server.
data FailedCommandInfo
FailedCommandInfo :: String -> Maybe SessionId -> Maybe ByteString -> Maybe String -> [StackFrame] -> FailedCommandInfo
errMsg :: FailedCommandInfo -> String
errSessId :: FailedCommandInfo -> Maybe SessionId
errScreen :: FailedCommandInfo -> Maybe ByteString
errClass :: FailedCommandInfo -> Maybe String
errStack :: FailedCommandInfo -> [StackFrame]
-- | An individual stack frame from the stack trace provided by the server
-- during a FailedCommand.
data StackFrame
StackFrame :: String -> String -> String -> Word -> StackFrame
sfFileName :: StackFrame -> String
sfClassName :: StackFrame -> String
sfMethodName :: StackFrame -> String
sfLineNumber :: StackFrame -> Word
-- | Constructs a FailedCommandInfo from only an error message.
mkFailedCommandInfo :: String -> FailedCommandInfo
-- | Convenience function to throw a FailedCommand locally with no
-- server-side info present.
failedCommand :: FailedCommandType -> String -> WD a