-- 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 Haskell. You can use it to automate -- browser sessions for testing, system administration, etc. -- -- For more information about Selenium itself, see -- http://seleniumhq.org/ -- -- To find out what's been changed in this version and others, see the -- change log at -- https://github.com/kallisti-dev/hs-webdriver/blob/master/CHANGELOG.md @package webdriver @version 0.8.5 module Test.WebDriver.Utils urlEncode :: Text -> Text module Test.WebDriver.Session.History data SessionHistory SessionHistory :: Request -> Either SomeException (Response ByteString) -> Int -> SessionHistory [histRequest] :: SessionHistory -> Request [histResponse] :: SessionHistory -> Either SomeException (Response ByteString) [histRetryCount] :: SessionHistory -> Int instance GHC.Show.Show Test.WebDriver.Session.History.SessionHistory module Test.WebDriver.Session -- | A class for monads that carry a WebDriver session with them. The -- MonadBaseControl superclass is used for exception handling through the -- lifted-base package. class (Monad m, Applicative m) => WDSessionState m -- | Retrieves the current session state of the monad getSession :: WDSessionState m => m WDSession -- | Sets a new session state for the monad putSession :: WDSessionState m => WDSession -> m () -- | Constraint synonym for the common pairing of WDSessionState and -- MonadBase IO. type WDSessionStateIO s = (WDSessionState s, MonadBase IO s) -- | 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. type WDSessionStateControl s = (WDSessionState s, MonadBaseControl IO s) modifySession :: WDSessionState s => (WDSession -> WDSession) -> s () -- | 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. withSession :: WDSessionStateControl m => WDSession -> m a -> m a -- | The local state of a WebDriver session. This structure is passed -- implicitly through all WD computations data WDSession WDSession :: ByteString -> Int -> ByteString -> Maybe SessionId -> [SessionHistory] -> SessionHistoryConfig -> Manager -> Int -> RequestHeaders -> RequestHeaders -> WDSession [wdSessHost] :: WDSession -> ByteString [wdSessPort] :: WDSession -> Int [wdSessBasePath] :: WDSession -> ByteString -- | 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 [wdSessId] :: WDSession -> Maybe SessionId -- | The complete history of HTTP requests and responses, most recent -- first. [wdSessHist] :: WDSession -> [SessionHistory] -- | Update function used to append new entries to session history [wdSessHistUpdate] :: WDSession -> SessionHistoryConfig -- | HTTP Manager used for connection pooling by the http-client -- library. [wdSessHTTPManager] :: WDSession -> Manager -- | Number of times to retry a HTTP request if it times out [wdSessHTTPRetryCount] :: WDSession -> Int -- | Custom request headers to add to every HTTP request. [wdSessRequestHeaders] :: WDSession -> RequestHeaders -- | Custom request headers to add *only* to session creation requests. -- This is usually done when a WebDriver server requires HTTP auth. [wdSessAuthHeaders] :: WDSession -> RequestHeaders -- | The most recent SessionHistory entry recorded by this session, if any. mostRecentHistory :: WDSession -> Maybe SessionHistory -- | The most recent HTTP request issued by this session, if any. mostRecentHTTPRequest :: WDSession -> Maybe Request -- | 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 data SessionHistory SessionHistory :: Request -> Either SomeException (Response ByteString) -> Int -> SessionHistory [histRequest] :: SessionHistory -> Request [histResponse] :: SessionHistory -> Either SomeException (Response ByteString) [histRetryCount] :: SessionHistory -> Int -- | A function used by wdHistoryConfig to append new entries to -- session history. type SessionHistoryConfig = SessionHistory -> [SessionHistory] -> [SessionHistory] -- | No session history is saved. noHistory :: SessionHistoryConfig -- | Keep unlimited history unlimitedHistory :: SessionHistoryConfig -- | Saves only the most recent history onlyMostRecentHistory :: SessionHistoryConfig -- | Set a temporary list of custom RequestHeaders to use within the -- given action. All previous custom headers are temporarily removed, and -- then restored at the end. withRequestHeaders :: WDSessionStateControl m => RequestHeaders -> m a -> m a -- | Makes all webdriver HTTP requests in the given action use the -- session's auth headers, typically configured by setting the -- wdAuthHeaders config. This is useful if you want to -- temporarily use the same auth headers you used for session creation -- with other HTTP requests. withAuthHeaders :: WDSessionStateControl m => m a -> m a instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Session.SessionId instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Session.SessionId instance GHC.Read.Read Test.WebDriver.Session.SessionId instance GHC.Show.Show Test.WebDriver.Session.SessionId instance GHC.Classes.Ord Test.WebDriver.Session.SessionId instance GHC.Classes.Eq Test.WebDriver.Session.SessionId instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.State.Lazy.StateT s m) instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.State.Strict.StateT s m) instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Maybe.MaybeT m) instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Identity.IdentityT m) instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.List.ListT m) instance (GHC.Base.Monoid w, Test.WebDriver.Session.WDSessionState m) => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Writer.Lazy.WriterT w m) instance (GHC.Base.Monoid w, Test.WebDriver.Session.WDSessionState m) => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Writer.Strict.WriterT w m) instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Reader.ReaderT r m) instance (Control.Monad.Trans.Error.Error e, Test.WebDriver.Session.WDSessionState m) => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Error.ErrorT e m) instance Test.WebDriver.Session.WDSessionState m => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.Except.ExceptT r m) instance (GHC.Base.Monoid w, Test.WebDriver.Session.WDSessionState m) => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.RWS.Strict.RWST r w s m) instance (GHC.Base.Monoid w, Test.WebDriver.Session.WDSessionState wd) => Test.WebDriver.Session.WDSessionState (Control.Monad.Trans.RWS.Lazy.RWST r w s wd) -- | A type for profile preferences. These preference values are used by -- both Firefox and Opera profiles. module Test.WebDriver.Common.Profile -- | This structure allows you to construct and manipulate profiles in pure -- code, deferring execution of IO operations until the profile is -- "prepared". This type is shared by both Firefox and Opera profiles; -- when a distinction must be made, the phantom type parameter is used to -- differentiate. data Profile b Profile :: HashMap FilePath FilePath -> HashMap Text ProfilePref -> Profile b -- | A mapping from relative destination filepaths to source filepaths -- found on the filesystem. When the profile is prepared, these source -- filepaths will be moved to their destinations within the profile -- directory. -- -- Using the destination path as the key ensures that there is one unique -- source path going to each destination path. [profileFiles] :: Profile b -> HashMap FilePath FilePath -- | A map of profile preferences. These are the settings found in the -- profile's prefs.js, and entries found in about:config [profilePrefs] :: Profile b -> HashMap Text ProfilePref -- | Represents a profile that has been prepared for network transmission. -- The profile cannot be modified in this form. newtype PreparedProfile b PreparedProfile :: ByteString -> PreparedProfile b -- | A profile preference value. This is the subset of JSON values that -- excludes arrays, objects, and null. data ProfilePref PrefInteger :: !Integer -> ProfilePref PrefDouble :: !Double -> ProfilePref PrefString :: !Text -> ProfilePref PrefBool :: !Bool -> ProfilePref -- | A typeclass to convert types to profile preference values class ToPref a toPref :: ToPref a => a -> ProfilePref -- | Retrieve a preference from a profile by key name. getPref :: Text -> Profile b -> Maybe ProfilePref -- | Add a new preference entry to a profile, overwriting any existing -- entry with the same key. addPref :: ToPref a => Text -> a -> Profile b -> Profile b -- | Delete an existing preference entry from a profile. This operation is -- silent if the preference wasn't found. deletePref :: Text -> Profile b -> Profile b -- | Add a new extension to the profile. The file path should refer to a -- .xpi file or an extension directory on the filesystem. addExtension :: FilePath -> Profile b -> Profile b -- | Delete an existing extension from the profile. The string parameter -- should refer to an .xpi file or directory located within the -- extensions directory of the profile. This operation has no effect if -- the extension was never added to the profile. deleteExtension :: String -> Profile b -> Profile b -- | Determines if a profile contains the given extension. specified as an -- .xpi file or directory name hasExtension :: String -> Profile b -> Bool -- | Add a file to the profile directory. The first argument is the source -- of the file on the local filesystem. The second argument is the -- destination as a path relative to a profile directory. Overwrites any -- file that previously pointed to the same destination addFile :: FilePath -> FilePath -> Profile b -> Profile b -- | Delete a file from the profile directory. The first argument is the -- name of file within the profile directory. deleteFile :: FilePath -> Profile b -> Profile b -- | Determines if a profile contains the given file, specified as a path -- relative to the profile directory. hasFile :: String -> Profile b -> Bool -- | Takes the union of two profiles. This is the union of their -- HashMap fields. unionProfiles :: Profile b -> Profile b -> Profile b -- | Modifies the profileFiles field of a profile onProfileFiles :: Profile b -> (HashMap FilePath FilePath -> HashMap FilePath FilePath) -> Profile b -- | Modifies the profilePrefs field of a profile. onProfilePrefs :: Profile b -> (HashMap Text ProfilePref -> HashMap Text ProfilePref) -> Profile b -- | Efficiently load an existing profile from disk and prepare it for -- network transmission. prepareLoadedProfile_ :: MonadBase IO m => FilePath -> m (PreparedProfile a) -- | Prepare a zip file of a profile on disk for network transmission. This -- function is very efficient at loading large profiles from disk. prepareZippedProfile :: MonadBase IO m => FilePath -> m (PreparedProfile a) -- | Prepare a zip archive of a profile for network transmission. prepareZipArchive :: Archive -> PreparedProfile a -- | Prepare a ByteString of raw zip data for network transmission prepareRawZip :: ByteString -> PreparedProfile a -- | An error occured while attempting to parse a profile's preference -- file. newtype ProfileParseError ProfileParseError :: String -> ProfileParseError instance GHC.Read.Read Test.WebDriver.Common.Profile.ProfileParseError instance GHC.Show.Show Test.WebDriver.Common.Profile.ProfileParseError instance GHC.Classes.Eq Test.WebDriver.Common.Profile.ProfileParseError instance GHC.Show.Show (Test.WebDriver.Common.Profile.Profile b) instance GHC.Classes.Eq (Test.WebDriver.Common.Profile.Profile b) instance GHC.Show.Show Test.WebDriver.Common.Profile.ProfilePref instance GHC.Classes.Eq Test.WebDriver.Common.Profile.ProfilePref instance GHC.Show.Show (Test.WebDriver.Common.Profile.PreparedProfile b) instance GHC.Classes.Eq (Test.WebDriver.Common.Profile.PreparedProfile b) instance Data.Aeson.Types.FromJSON.FromJSON (Test.WebDriver.Common.Profile.PreparedProfile s) instance Data.Aeson.Types.ToJSON.ToJSON (Test.WebDriver.Common.Profile.PreparedProfile s) instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Common.Profile.ProfilePref instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Common.Profile.ProfilePref instance GHC.Exception.Exception Test.WebDriver.Common.Profile.ProfileParseError instance Test.WebDriver.Common.Profile.ToPref Data.Text.Internal.Text instance Test.WebDriver.Common.Profile.ToPref GHC.Base.String instance Test.WebDriver.Common.Profile.ToPref GHC.Types.Bool instance Test.WebDriver.Common.Profile.ToPref GHC.Integer.Type.Integer instance Test.WebDriver.Common.Profile.ToPref GHC.Types.Int instance Test.WebDriver.Common.Profile.ToPref GHC.Int.Int8 instance Test.WebDriver.Common.Profile.ToPref GHC.Int.Int16 instance Test.WebDriver.Common.Profile.ToPref GHC.Int.Int32 instance Test.WebDriver.Common.Profile.ToPref GHC.Int.Int64 instance Test.WebDriver.Common.Profile.ToPref GHC.Types.Word instance Test.WebDriver.Common.Profile.ToPref GHC.Word.Word8 instance Test.WebDriver.Common.Profile.ToPref GHC.Word.Word16 instance Test.WebDriver.Common.Profile.ToPref GHC.Word.Word32 instance Test.WebDriver.Common.Profile.ToPref GHC.Word.Word64 instance Test.WebDriver.Common.Profile.ToPref GHC.Types.Double instance Test.WebDriver.Common.Profile.ToPref GHC.Types.Float instance GHC.Real.Integral a => Test.WebDriver.Common.Profile.ToPref (GHC.Real.Ratio a) instance Data.Fixed.HasResolution r => Test.WebDriver.Common.Profile.ToPref (Data.Fixed.Fixed r) instance Test.WebDriver.Common.Profile.ToPref Test.WebDriver.Common.Profile.ProfilePref -- | 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 -- | Phantom type used in the parameters of Profile and -- PreparedProfile data Firefox -- | This structure allows you to construct and manipulate profiles in pure -- code, deferring execution of IO operations until the profile is -- "prepared". This type is shared by both Firefox and Opera profiles; -- when a distinction must be made, the phantom type parameter is used to -- differentiate. data Profile b Profile :: HashMap FilePath FilePath -> HashMap Text ProfilePref -> Profile b -- | A mapping from relative destination filepaths to source filepaths -- found on the filesystem. When the profile is prepared, these source -- filepaths will be moved to their destinations within the profile -- directory. -- -- Using the destination path as the key ensures that there is one unique -- source path going to each destination path. [profileFiles] :: Profile b -> HashMap FilePath FilePath -- | A map of profile preferences. These are the settings found in the -- profile's prefs.js, and entries found in about:config [profilePrefs] :: Profile b -> HashMap Text ProfilePref -- | Represents a profile that has been prepared for network transmission. -- The profile cannot be modified in this form. data PreparedProfile b -- | Default Firefox Profile, used when no profile is supplied. defaultProfile :: Profile Firefox -- | A profile preference value. This is the subset of JSON values that -- excludes arrays, objects, and null. data ProfilePref PrefInteger :: !Integer -> ProfilePref PrefDouble :: !Double -> ProfilePref PrefString :: !Text -> ProfilePref PrefBool :: !Bool -> ProfilePref -- | A typeclass to convert types to profile preference values class ToPref a toPref :: ToPref a => a -> ProfilePref -- | Add a new preference entry to a profile, overwriting any existing -- entry with the same key. addPref :: ToPref a => Text -> a -> Profile b -> Profile b -- | Retrieve a preference from a profile by key name. getPref :: Text -> Profile b -> Maybe ProfilePref -- | Delete an existing preference entry from a profile. This operation is -- silent if the preference wasn't found. deletePref :: Text -> Profile b -> Profile b -- | Add a new extension to the profile. The file path should refer to a -- .xpi file or an extension directory on the filesystem. addExtension :: FilePath -> Profile b -> Profile b -- | Delete an existing extension from the profile. The string parameter -- should refer to an .xpi file or directory located within the -- extensions directory of the profile. This operation has no effect if -- the extension was never added to the profile. deleteExtension :: String -> Profile b -> Profile b -- | Determines if a profile contains the given extension. specified as an -- .xpi file or directory name hasExtension :: String -> Profile b -> Bool -- | Add a file to the profile directory. The first argument is the source -- of the file on the local filesystem. The second argument is the -- destination as a path relative to a profile directory. Overwrites any -- file that previously pointed to the same destination addFile :: FilePath -> FilePath -> Profile b -> Profile b -- | Delete a file from the profile directory. The first argument is the -- name of file within the profile directory. deleteFile :: FilePath -> Profile b -> Profile b -- | Determines if a profile contains the given file, specified as a path -- relative to the profile directory. hasFile :: String -> Profile b -> Bool -- | Takes the union of two profiles. This is the union of their -- HashMap fields. unionProfiles :: Profile b -> Profile b -> Profile b -- | Modifies the profileFiles field of a profile onProfileFiles :: Profile b -> (HashMap FilePath FilePath -> HashMap FilePath FilePath) -> Profile b -- | Modifies the profilePrefs field of a profile. onProfilePrefs :: Profile b -> (HashMap Text ProfilePref -> HashMap Text ProfilePref) -> Profile b -- | Prepare a firefox profile 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. -- -- NOTE: because this function has to copy the profile files into a a -- temp directory before zip archiving them, this operation is likely to -- be slow for large profiles. In such a case, consider using -- prepareLoadedProfile_ or prepareZippedProfile instead. prepareProfile :: MonadBaseControl IO m => Profile Firefox -> m (PreparedProfile Firefox) -- | Apply a function on a default profile, and prepare the result. The -- Profile passed to the handler function is the default profile used by -- sessions when Nothing is specified prepareTempProfile :: MonadBaseControl IO m => (Profile Firefox -> Profile Firefox) -> m (PreparedProfile Firefox) -- | Load an existing profile from the file system. Any prepared changes -- made to the Profile will have no effect to the profile on disk. -- -- To make automated browser run smoothly, preferences found in -- defaultProfile are automatically merged into the preferences of -- the on-disk-- profile. The on-disk profile's preference will override -- those found in the default profile. loadProfile :: MonadBaseControl IO m => FilePath -> m (Profile Firefox) -- | Convenience function to load an existing Firefox profile from disk, -- apply a handler function, and then prepare the result for network -- transmission. -- -- NOTE: like prepareProfile, the same caveat about large profiles -- applies. prepareLoadedProfile :: MonadBaseControl IO m => FilePath -> (Profile Firefox -> Profile Firefox) -> m (PreparedProfile Firefox) -- | Efficiently load an existing profile from disk and prepare it for -- network transmission. prepareLoadedProfile_ :: MonadBase IO m => FilePath -> m (PreparedProfile a) -- | Prepare a zip file of a profile on disk for network transmission. This -- function is very efficient at loading large profiles from disk. prepareZippedProfile :: MonadBase IO m => FilePath -> m (PreparedProfile a) -- | Prepare a zip archive of a profile for network transmission. prepareZipArchive :: Archive -> PreparedProfile a -- | Prepare a ByteString of raw zip data for network transmission prepareRawZip :: ByteString -> PreparedProfile a -- | An error occured while attempting to parse a profile's preference -- file. newtype ProfileParseError ProfileParseError :: String -> ProfileParseError -- | This module contains named constants corresponding to the special -- characters recognized by sendKeys. For more details on these -- special characters, consult the Selenium documentation at -- https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidvalue module Test.WebDriver.Common.Keys add :: Text alt :: Text arrowDown :: Text arrowLeft :: Text arrowRight :: Text arrowUp :: Text backspace :: Text backSpace :: Text cancel :: Text clear :: Text command :: Text control :: Text decimal :: Text delete :: Text divide :: Text down :: Text end :: Text enter :: Text equals :: Text escape :: Text f1 :: Text f2 :: Text f3 :: Text f4 :: Text f5 :: Text f6 :: Text f7 :: Text f8 :: Text f9 :: Text f10 :: Text f11 :: Text f12 :: Text help :: Text home :: Text insert :: Text left :: Text leftAlt :: Text leftControl :: Text leftShift :: Text meta :: Text multiply :: Text null :: Text numpad0 :: Text numpad1 :: Text numpad2 :: Text numpad3 :: Text numpad4 :: Text numpad5 :: Text numpad6 :: Text numpad7 :: Text numpad8 :: Text numpad9 :: Text pageDown :: Text pageUp :: Text pause :: Text return :: Text right :: Text semicolon :: Text separator :: Text shift :: Text space :: Text subtract :: Text tab :: Text up :: Text module Test.WebDriver.Class -- | A class for monads that can handle wire protocol requests. This is the -- operation underlying all of the high-level commands exported in -- Test.WebDriver.Commands. For more information on the wire -- protocol see -- https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol class (WDSessionStateControl wd) => WebDriver wd doCommand :: (WebDriver wd, ToJSON a, FromJSON b) => Method -> Text -> a -> wd b -- | HTTP method (flat string type). type Method = ByteString -- | HTTP Method constants. methodDelete :: Method -- | HTTP Method constants. methodGet :: Method -- | HTTP Method constants. methodPost :: Method instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.State.Strict.StateT s wd) instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.State.Lazy.StateT s wd) instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Maybe.MaybeT wd) instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Identity.IdentityT wd) instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.List.ListT wd) instance (GHC.Base.Monoid w, Test.WebDriver.Class.WebDriver wd) => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Writer.Lazy.WriterT w wd) instance (GHC.Base.Monoid w, Test.WebDriver.Class.WebDriver wd) => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Writer.Strict.WriterT w wd) instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Reader.ReaderT r wd) instance (Control.Monad.Trans.Error.Error e, Test.WebDriver.Class.WebDriver wd) => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Error.ErrorT e wd) instance Test.WebDriver.Class.WebDriver wd => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.Except.ExceptT e wd) instance (GHC.Base.Monoid w, Test.WebDriver.Class.WebDriver wd) => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.RWS.Strict.RWST r w s wd) instance (GHC.Base.Monoid w, Test.WebDriver.Class.WebDriver wd) => Test.WebDriver.Class.WebDriver (Control.Monad.Trans.RWS.Lazy.RWST r w s wd) -- | Internal functions used to implement the functions exported by -- Test.WebDriver.Commands. These may be useful for implementing -- non-standard webdriver commands. module Test.WebDriver.Commands.Internal doCommand :: (WebDriver wd, ToJSON a, FromJSON b) => Method -> Text -> a -> wd b -- | This a convenient wrapper around doCommand that automatically -- prepends the session URL parameter to the wire command URL. For -- example, passing a URL of "refresh" will expand to -- "session:sessionIdrefresh", where :sessionId is a URL -- parameter as described in -- https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol doSessCommand :: (WebDriver wd, ToJSON a, FromJSON b) => Method -> Text -> a -> wd b -- | 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 wrapper around doSessCommand to create element URLs. For -- example, passing a URL of "/active" will expand to -- "session:sessionIdelement:id/active", where :sessionId -- and :id are URL parameters as described in the wire protocol. doElemCommand :: (WebDriver wd, ToJSON a, FromJSON b) => Method -> Element -> Text -> a -> wd b -- | An opaque identifier for a web page element. newtype Element Element :: Text -> Element -- | A wrapper around doSessCommand to create window handle URLS. -- For example, passing a URL of "/size" will expand to -- "session:sessionIdwindow:windowHandle/", where -- :sessionId and :windowHandle are URL parameters as described in the -- wire protocol doWinCommand :: (WebDriver wd, ToJSON a, FromJSON b) => Method -> WindowHandle -> Text -> a -> wd b -- | An opaque identifier for a browser window newtype WindowHandle WindowHandle :: Text -> WindowHandle -- | A special WindowHandle that always refers to the currently -- focused window. This is also used by the Default instance. currentWindow :: WindowHandle -- | A command requiring a session ID was attempted when no session ID was -- available. newtype NoSessionId NoSessionId :: String -> NoSessionId instance GHC.Show.Show Test.WebDriver.Commands.Internal.NoSessionId instance GHC.Classes.Eq Test.WebDriver.Commands.Internal.NoSessionId instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.Internal.WindowHandle instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.Internal.WindowHandle instance GHC.Read.Read Test.WebDriver.Commands.Internal.WindowHandle instance GHC.Show.Show Test.WebDriver.Commands.Internal.WindowHandle instance GHC.Classes.Ord Test.WebDriver.Commands.Internal.WindowHandle instance GHC.Classes.Eq Test.WebDriver.Commands.Internal.WindowHandle instance GHC.Read.Read Test.WebDriver.Commands.Internal.Element instance GHC.Show.Show Test.WebDriver.Commands.Internal.Element instance GHC.Classes.Ord Test.WebDriver.Commands.Internal.Element instance GHC.Classes.Eq Test.WebDriver.Commands.Internal.Element instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.Internal.Element instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.Internal.Element instance Data.Default.Class.Default Test.WebDriver.Commands.Internal.WindowHandle instance GHC.Exception.Exception Test.WebDriver.Commands.Internal.NoSessionId -- | A collection of convenience functions for using and parsing JSON -- values within WD. All monadic parse errors are converted to -- asynchronous BadJSON exceptions. -- -- These functions are used internally to implement webdriver commands, -- and may be useful for implementing non-standard commands. module Test.WebDriver.JSON -- | This operator is a wrapper over Aeson's .: operator. (!:) :: (MonadBaseControl IO wd, FromJSON a) => Object -> Text -> wd a -- | Due to a breaking change in the .:? operator of aeson 0.10 (see -- https://github.com/bos/aeson/issues/287) that was subsequently -- reverted, this operator was added to provide consistent behavior -- compatible with all aeson versions. If the field is either missing or -- Null, this operator should return a Nothing result. (.:??) :: FromJSON a => Object -> Text -> Parser (Maybe a) -- | Parse a lazy ByteString as a top-level JSON Value, then -- convert it to an instance of FromJSON.. parseJSON' :: MonadBaseControl IO wd => FromJSON a => ByteString -> wd a -- | Convert a JSON Value to an instance of FromJSON. fromJSON' :: MonadBaseControl IO wd => 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 third string is the -- name of the calling function, for better error reporting. parsePair :: (MonadBaseControl IO wd, 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 :: (MonadBaseControl IO wd, FromJSON a, FromJSON b, FromJSON c) => String -> String -> String -> String -> Value -> wd (a, b, c) -- | Convert an attoparsec parser result to WD. apResultToWD :: (MonadBaseControl IO wd, FromJSON a) => Result Value -> wd a -- | Convert an Aeson parser result to WD. aesonResultToWD :: (MonadBaseControl IO wd) => Result a -> wd a -- | An error occured when parsing a JSON value. newtype BadJSON BadJSON :: String -> BadJSON -- | A type indicating that we expect no return value from the webdriver -- request. Its FromJSON instance parses successfully for any values that -- indicate lack of a return value (a notion that varies from server to -- server). data NoReturn NoReturn :: NoReturn -- | Convenience function to handle webdriver commands with no return -- value. noReturn :: WebDriver wd => wd NoReturn -> wd () -- | Convenience function to ignore result of a webdriver command. ignoreReturn :: WebDriver wd => wd Value -> wd () instance GHC.Show.Show Test.WebDriver.JSON.BadJSON instance GHC.Classes.Eq Test.WebDriver.JSON.BadJSON instance GHC.Exception.Exception Test.WebDriver.JSON.BadJSON instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.JSON.NoReturn module Test.WebDriver.Exceptions.Internal -- | An invalid URL was given newtype InvalidURL InvalidURL :: String -> InvalidURL -- | An unexpected HTTP status was sent by the server. data HTTPStatusUnknown HTTPStatusUnknown :: Int -> String -> HTTPStatusUnknown -- | HTTP connection errors. data HTTPConnError HTTPConnError :: String -> Int -> 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 a broad variety of exceptions that can -- occur when a command fails. data FailedCommand FailedCommand :: FailedCommandType -> FailedCommandInfo -> FailedCommand -- | Convenience function to throw a FailedCommand locally with no -- server-side info present. failedCommand :: (WDSessionStateIO s) => FailedCommandType -> String -> s a -- | Constructs a FailedCommandInfo from only an error message. mkFailedCommandInfo :: (WDSessionState s) => String -> s FailedCommandInfo -- | 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 SessionNotCreated :: FailedCommandType MoveTargetOutOfBounds :: FailedCommandType InvalidXPathSelector :: FailedCommandType InvalidXPathSelectorReturnType :: FailedCommandType -- | Detailed information about the failed command provided by the server. data FailedCommandInfo FailedCommandInfo :: String -> Maybe WDSession -> Maybe ByteString -> Maybe String -> [StackFrame] -> FailedCommandInfo -- | The error message. [errMsg] :: FailedCommandInfo -> String -- | The session associated with the exception. [errSess] :: FailedCommandInfo -> Maybe WDSession -- | A screen shot of the focused window when the exception occured, if -- provided. [errScreen] :: FailedCommandInfo -> Maybe ByteString -- | The "class" in which the exception was raised, if provided. [errClass] :: FailedCommandInfo -> Maybe String -- | A stack trace of the exception. [errStack] :: FailedCommandInfo -> [StackFrame] -- | An individual stack frame from the stack trace provided by the server -- during a FailedCommand. data StackFrame StackFrame :: String -> String -> String -> Int -> StackFrame [sfFileName] :: StackFrame -> String [sfClassName] :: StackFrame -> String [sfMethodName] :: StackFrame -> String [sfLineNumber] :: StackFrame -> Int instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.FailedCommand instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.StackFrame instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.FailedCommandType instance GHC.Enum.Bounded Test.WebDriver.Exceptions.Internal.FailedCommandType instance GHC.Enum.Enum Test.WebDriver.Exceptions.Internal.FailedCommandType instance GHC.Classes.Ord Test.WebDriver.Exceptions.Internal.FailedCommandType instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.FailedCommandType instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.ServerError instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.ServerError instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.UnknownCommand instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.UnknownCommand instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.HTTPConnError instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.HTTPConnError instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.HTTPStatusUnknown instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.HTTPStatusUnknown instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.InvalidURL instance GHC.Classes.Eq Test.WebDriver.Exceptions.Internal.InvalidURL instance GHC.Exception.Exception Test.WebDriver.Exceptions.Internal.InvalidURL instance GHC.Exception.Exception Test.WebDriver.Exceptions.Internal.HTTPStatusUnknown instance GHC.Exception.Exception Test.WebDriver.Exceptions.Internal.HTTPConnError instance GHC.Exception.Exception Test.WebDriver.Exceptions.Internal.UnknownCommand instance GHC.Exception.Exception Test.WebDriver.Exceptions.Internal.ServerError instance GHC.Exception.Exception Test.WebDriver.Exceptions.Internal.FailedCommand instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.FailedCommandInfo instance GHC.Show.Show Test.WebDriver.Exceptions.Internal.StackFrame instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Exceptions.Internal.FailedCommandInfo instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Exceptions.Internal.StackFrame module Test.WebDriver.Exceptions -- | 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 -> String -> HTTPStatusUnknown -- | HTTP connection errors. data HTTPConnError HTTPConnError :: String -> Int -> 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 a broad variety 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 SessionNotCreated :: FailedCommandType MoveTargetOutOfBounds :: FailedCommandType InvalidXPathSelector :: FailedCommandType InvalidXPathSelectorReturnType :: FailedCommandType -- | Detailed information about the failed command provided by the server. data FailedCommandInfo FailedCommandInfo :: String -> Maybe WDSession -> Maybe ByteString -> Maybe String -> [StackFrame] -> FailedCommandInfo -- | The error message. [errMsg] :: FailedCommandInfo -> String -- | The session associated with the exception. [errSess] :: FailedCommandInfo -> Maybe WDSession -- | A screen shot of the focused window when the exception occured, if -- provided. [errScreen] :: FailedCommandInfo -> Maybe ByteString -- | The "class" in which the exception was raised, if provided. [errClass] :: FailedCommandInfo -> Maybe String -- | A stack trace of the exception. [errStack] :: FailedCommandInfo -> [StackFrame] -- | An individual stack frame from the stack trace provided by the server -- during a FailedCommand. data StackFrame StackFrame :: String -> String -> String -> Int -> StackFrame [sfFileName] :: StackFrame -> String [sfClassName] :: StackFrame -> String [sfMethodName] :: StackFrame -> String [sfLineNumber] :: StackFrame -> Int -- | Constructs a FailedCommandInfo from only an error message. mkFailedCommandInfo :: (WDSessionState s) => String -> s FailedCommandInfo -- | Convenience function to throw a FailedCommand locally with no -- server-side info present. failedCommand :: (WDSessionStateIO s) => FailedCommandType -> String -> s a -- | The HTTP/JSON plumbing used to implement the WD monad. -- -- These functions can be used to create your own WebDriver -- instances, providing extra functionality for your application if -- desired. All exports of this module are subject to change at any -- point. module Test.WebDriver.Internal -- | Constructs an HTTP Request value when given a list of headers, -- HTTP request method, and URL fragment mkRequest :: (WDSessionState s, ToJSON a) => Method -> Text -> a -> s Request -- | Sends an HTTP request to the remote WebDriver server sendHTTPRequest :: (WDSessionStateIO s) => Request -> s (Either SomeException (Response ByteString)) -- | Parses a WDResponse object from a given HTTP response. getJSONResult :: (WDSessionStateControl s, FromJSON a) => Response ByteString -> s (Either SomeException a) handleJSONErr :: (WDSessionStateControl s) => WDResponse -> s (Maybe SomeException) handleRespSessionId :: (WDSessionStateIO s) => WDResponse -> s () -- | Internal type representing the JSON response object data WDResponse WDResponse :: Maybe SessionId -> Word8 -> Value -> WDResponse [rspSessId] :: WDResponse -> Maybe SessionId [rspStatus] :: WDResponse -> Word8 [rspVal] :: WDResponse -> Value instance GHC.Show.Show Test.WebDriver.Internal.WDResponse instance GHC.Classes.Eq Test.WebDriver.Internal.WDResponse instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Internal.WDResponse -- | Functions and types for working with Google Chrome extensions. module Test.WebDriver.Chrome.Extension -- | An opaque type representing a Google Chrome extension. Values of this -- type are passed to the chromeExtensions field. data ChromeExtension -- | Load a .crx file as a ChromeExtension. loadExtension :: MonadBase IO m => FilePath -> m ChromeExtension -- | Load raw .crx data as a ChromeExtension. loadRawExtension :: ByteString -> ChromeExtension instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Chrome.Extension.ChromeExtension instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Chrome.Extension.ChromeExtension instance GHC.Read.Read Test.WebDriver.Chrome.Extension.ChromeExtension instance GHC.Show.Show Test.WebDriver.Chrome.Extension.ChromeExtension instance GHC.Classes.Eq Test.WebDriver.Chrome.Extension.ChromeExtension module Test.WebDriver.Capabilities -- | A typeclass for readable Capabilities class GetCapabilities t getCaps :: GetCapabilities t => t -> Capabilities -- | A typeclass for writable Capabilities class SetCapabilities t setCaps :: SetCapabilities t => Capabilities -> t -> t -- | Read/write Capabilities type HasCapabilities t = (GetCapabilities t, SetCapabilities t) -- | Modifies the wdCapabilities field of a WDConfig by -- applying the given function. Overloaded to work with any -- HasCapabilities instance. modifyCaps :: HasCapabilities t => (Capabilities -> Capabilities) -> t -> t -- | A helper function for setting the browser capability of a -- HasCapabilities instance useBrowser :: HasCapabilities t => Browser -> t -> t -- | A helper function for setting the version capability of a -- HasCapabilities instance useVersion :: HasCapabilities t => String -> t -> t -- | A helper function for setting the platform capability of a -- HasCapabilities instance usePlatform :: HasCapabilities t => Platform -> t -> t -- | A helper function for setting the useProxy capability of a -- HasCapabilities instance useProxy :: HasCapabilities t => ProxyType -> t -> t -- | A structure describing the capabilities of a session. This record -- serves dual roles. -- --
-- jsExample = do -- e <- findElem (ById "foo") -- executeJS [] "someAction()" -- return e ---- -- Because the result of the executeJS is discarded, GHC cannot -- resolve which instance of the fromJSON class to use when -- parsing the Selenium server response. In such cases, we can use the -- ignoreReturn helper function located in -- Test.WebDriver.JSON. ignoreReturn has no runtime effect; -- it simply helps the type system by expicitly providing a -- fromJSON instance to use. -- --
-- import Test.WebDriver.JSON (ignoreReturn) -- jsExample = do -- e <- findElem (ById "foo") -- ignoreReturn $ executeJS [] "someAction()" -- return e --executeJS :: (Foldable f, FromJSON a, WebDriver wd) => f 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 :: (Foldable f, FromJSON a, WebDriver wd) => f 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. This is also used by the Default instance. currentWindow :: WindowHandle -- | Returns a handle to the currently focused window getCurrentWindow :: WebDriver wd => wd WindowHandle -- | Closes the given window closeWindow :: WebDriver wd => WindowHandle -> wd () -- | Returns a list of all windows available to the session windows :: WebDriver wd => wd [WindowHandle] focusWindow :: WebDriver wd => WindowHandle -> wd () -- | Maximizes the current window if not already maximized maximize :: WebDriver wd => wd () -- | Get the dimensions of the current window. getWindowSize :: WebDriver wd => wd (Word, Word) -- | Set the dimensions of the current window. setWindowSize :: WebDriver wd => (Word, Word) -> wd () -- | Get the coordinates of the current window. getWindowPos :: WebDriver wd => wd (Int, Int) -- | Set the coordinates of the current window. setWindowPos :: WebDriver wd => (Int, Int) -> wd () -- | Switch focus to the frame specified by the FrameSelector. focusFrame :: WebDriver wd => FrameSelector -> wd () -- | Specifies the frame used by focusFrame data FrameSelector WithIndex :: Integer -> FrameSelector -- | focus on a frame by name or ID WithName :: Text -> FrameSelector -- | focus on a frame Element WithElement :: Element -> FrameSelector -- | focus on the first frame, or the main document if iframes are used. DefaultFrame :: FrameSelector -- | Cookies are delicious delicacies. When sending cookies to the server, -- a value of Nothing indicates that the server should use a default -- value. When receiving cookies from the server, a value of Nothing -- indicates that the server is unable to specify the value. data Cookie Cookie :: Text -> Text -> Maybe Text -> Maybe Text -> Maybe Bool -> Maybe Integer -> Cookie [cookName] :: Cookie -> Text [cookValue] :: Cookie -> Text -- | path of this cookie. if Nothing, defaults to / [cookPath] :: Cookie -> Maybe Text -- | domain of this cookie. if Nothing, the current pages domain is used [cookDomain] :: Cookie -> Maybe Text -- | Is this cookie secure? [cookSecure] :: Cookie -> Maybe Bool -- | Expiry date expressed as seconds since the Unix epoch Nothing -- indicates that the cookie never expires [cookExpiry] :: Cookie -> Maybe Integer -- | Creates a Cookie with only a name and value specified. All other -- fields are set to Nothing, which tells the server to use default -- values. mkCookie :: Text -> Text -> Cookie -- | Retrieve all cookies visible to the current page. cookies :: WebDriver wd => 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 :: WebDriver wd => Cookie -> wd () -- | Delete a cookie. This will do nothing is the cookie isn't visible to -- the current page. deleteCookie :: WebDriver wd => Cookie -> wd () -- | Delete all visible cookies on the current page. deleteVisibleCookies :: WebDriver wd => wd () deleteCookieByName :: WebDriver wd => Text -> wd () -- | Get the text of an alert dialog. getAlertText :: WebDriver wd => wd Text -- | Sends keystrokes to Javascript prompt() dialog. replyToAlert :: WebDriver wd => Text -> wd () -- | Accepts the currently displayed alert dialog. acceptAlert :: WebDriver wd => wd () -- | Dismisses the currently displayed alert dialog. dismissAlert :: WebDriver wd => wd () -- | Moves the mouse to the given position relative to the active element. moveTo :: WebDriver wd => (Int, Int) -> wd () -- | Moves the mouse to the center of a given element. moveToCenter :: WebDriver wd => Element -> wd () -- | Moves the mouse to the given position relative to the given element. moveToFrom :: WebDriver wd => (Int, Int) -> Element -> wd () -- | Click at the current mouse position with the given mouse button. clickWith :: WebDriver wd => 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 :: WebDriver wd => wd () -- | Release the left mouse button. mouseUp :: WebDriver wd => wd () -- | Perform the given action with the left mouse button held down. The -- mouse is automatically released afterwards. withMouseDown :: WebDriver wd => wd a -> wd a -- | Double click at the current mouse location. doubleClick :: WebDriver wd => wd () -- | An HTML 5 storage type data WebStorageType LocalStorage :: WebStorageType SessionStorage :: WebStorageType -- | Get the current number of keys in a web storage area. storageSize :: WebDriver wd => WebStorageType -> wd Integer -- | Get a list of all keys from a web storage area. getAllKeys :: WebDriver wd => WebStorageType -> wd [Text] -- | Delete all keys within a given web storage area. deleteAllKeys :: WebDriver wd => WebStorageType -> wd () -- | Get the value associated with a key in the given web storage area. -- Unset keys result in empty strings, since the Web Storage spec makes -- no distinction between the empty string and an undefined value. getKey :: WebDriver wd => WebStorageType -> Text -> wd Text -- | Set a key in the given web storage area. setKey :: WebDriver wd => WebStorageType -> Text -> Text -> wd Text -- | Delete a key in the given web storage area. deleteKey :: WebDriver wd => WebStorageType -> Text -> wd () data ApplicationCacheStatus Uncached :: ApplicationCacheStatus Idle :: ApplicationCacheStatus Checking :: ApplicationCacheStatus Downloading :: ApplicationCacheStatus UpdateReady :: ApplicationCacheStatus Obsolete :: ApplicationCacheStatus getApplicationCacheStatus :: (WebDriver wd) => wd ApplicationCacheStatus -- | A screen orientation data Orientation Landscape :: Orientation Portrait :: Orientation -- | Get the current screen orientation for rotatable display devices. getOrientation :: WebDriver wd => wd Orientation -- | Set the current screen orientation for rotatable display devices. setOrientation :: WebDriver wd => Orientation -> wd () -- | Get the current geographical location of the device. getLocation :: WebDriver wd => wd (Int, Int, Int) -- | Set the current geographical location of the device. setLocation :: WebDriver wd => (Int, Int, Int) -> wd () -- | Single tap on the touch screen at the given element's location. touchClick :: WebDriver wd => Element -> wd () -- | Emulates pressing a finger down on the screen at the given location. touchDown :: WebDriver wd => (Int, Int) -> wd () -- | Emulates removing a finger from the screen at the given location. touchUp :: WebDriver wd => (Int, Int) -> wd () -- | Emulates moving a finger on the screen to the given location. touchMove :: WebDriver wd => (Int, Int) -> wd () -- | Emulate finger-based touch scroll. Use this function if you don't care -- where the scroll begins touchScroll :: WebDriver wd => (Int, Int) -> wd () -- | Emulate finger-based touch scroll, starting from the given location -- relative to the given element. touchScrollFrom :: WebDriver wd => (Int, Int) -> Element -> wd () -- | Emulate a double click on a touch device. touchDoubleClick :: WebDriver wd => Element -> wd () -- | Emulate a long click on a touch device. touchLongClick :: WebDriver wd => 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 :: WebDriver wd => (Int, Int) -> wd () -- | Emulate a flick on the touch screen. touchFlickFrom :: WebDriver wd => Int -> (Int, Int) -> Element -> wd () availableIMEEngines :: WebDriver wd => wd [Text] activeIMEEngine :: WebDriver wd => wd Text checkIMEActive :: WebDriver wd => wd Bool activateIME :: WebDriver wd => Text -> wd () deactivateIME :: WebDriver wd => wd () -- | Uploads a file from the local filesystem by its file path. uploadFile :: WebDriver wd => FilePath -> wd () -- | Uploads a raw bytestring with associated file info. uploadRawFile :: WebDriver wd => FilePath -> Integer -> ByteString -> wd () -- | Lowest level interface to the file uploading mechanism. This allows -- you to specify the exact details of the zip entry sent across network. uploadZipEntry :: WebDriver wd => Entry -> wd () -- | Get information from the server as a JSON Object. For more -- information about this object see -- https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#status serverStatus :: (WebDriver wd) => wd Value -- | Retrieve the log buffer for a given log type. The server-side log -- buffer is reset after each request. -- -- Which log types are available is server defined, but the wire protocol -- lists these as common log types: client, driver, browser, server getLogs :: WebDriver wd => LogType -> wd [LogEntry] -- | Get a list of available log types. getLogTypes :: WebDriver wd => wd [LogType] type LogType = String -- | A record that represents a single log entry. data LogEntry LogEntry :: Integer -> LogLevel -> Text -> LogEntry -- | timestamp for the log entry. The standard does not specify the epoch -- or the unit of time. [logTime] :: LogEntry -> Integer -- | log verbosity level [logLevel] :: LogEntry -> LogLevel [logMsg] :: LogEntry -> Text -- | Indicates a log verbosity level. Used in Firefox and -- Opera configuration. data LogLevel LogOff :: LogLevel LogSevere :: LogLevel LogWarning :: LogLevel LogInfo :: LogLevel LogConfig :: LogLevel LogFine :: LogLevel LogFiner :: LogLevel LogFinest :: LogLevel LogAll :: LogLevel instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.Cookie instance GHC.Read.Read Test.WebDriver.Commands.ApplicationCacheStatus instance GHC.Show.Show Test.WebDriver.Commands.ApplicationCacheStatus instance GHC.Classes.Ord Test.WebDriver.Commands.ApplicationCacheStatus instance GHC.Enum.Bounded Test.WebDriver.Commands.ApplicationCacheStatus instance GHC.Enum.Enum Test.WebDriver.Commands.ApplicationCacheStatus instance GHC.Classes.Eq Test.WebDriver.Commands.ApplicationCacheStatus instance GHC.Read.Read Test.WebDriver.Commands.LogEntry instance GHC.Show.Show Test.WebDriver.Commands.LogEntry instance GHC.Classes.Ord Test.WebDriver.Commands.LogEntry instance GHC.Classes.Eq Test.WebDriver.Commands.LogEntry instance GHC.Enum.Enum Test.WebDriver.Commands.WebStorageType instance GHC.Enum.Bounded Test.WebDriver.Commands.WebStorageType instance GHC.Classes.Ord Test.WebDriver.Commands.WebStorageType instance GHC.Show.Show Test.WebDriver.Commands.WebStorageType instance GHC.Classes.Eq Test.WebDriver.Commands.WebStorageType instance GHC.Enum.Enum Test.WebDriver.Commands.MouseButton instance GHC.Enum.Bounded Test.WebDriver.Commands.MouseButton instance GHC.Classes.Ord Test.WebDriver.Commands.MouseButton instance GHC.Show.Show Test.WebDriver.Commands.MouseButton instance GHC.Classes.Eq Test.WebDriver.Commands.MouseButton instance GHC.Enum.Enum Test.WebDriver.Commands.Orientation instance GHC.Enum.Bounded Test.WebDriver.Commands.Orientation instance GHC.Classes.Ord Test.WebDriver.Commands.Orientation instance GHC.Show.Show Test.WebDriver.Commands.Orientation instance GHC.Classes.Eq Test.WebDriver.Commands.Orientation instance GHC.Classes.Ord Test.WebDriver.Commands.Selector instance GHC.Show.Show Test.WebDriver.Commands.Selector instance GHC.Classes.Eq Test.WebDriver.Commands.Selector instance GHC.Show.Show Test.WebDriver.Commands.Cookie instance GHC.Classes.Eq Test.WebDriver.Commands.Cookie instance GHC.Read.Read Test.WebDriver.Commands.FrameSelector instance GHC.Show.Show Test.WebDriver.Commands.FrameSelector instance GHC.Classes.Eq Test.WebDriver.Commands.FrameSelector instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.JSArg instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.FrameSelector instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.Cookie instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.Selector instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.Orientation instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.Orientation instance Data.Aeson.Types.ToJSON.ToJSON Test.WebDriver.Commands.MouseButton instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.MouseButton instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.LogEntry instance Data.Aeson.Types.FromJSON.FromJSON Test.WebDriver.Commands.ApplicationCacheStatus module Test.WebDriver.Commands.Wait -- | Wait until either the given action succeeds or the timeout is reached. -- The action will be retried every .5 seconds until no -- ExpectFailed or FailedCommand NoSuchElement -- exceptions occur. If the timeout is reached, then a Timeout -- exception will be raised. The timeout value is expressed in seconds. waitUntil :: (WDSessionStateControl m) => Double -> m a -> m 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' :: (WDSessionStateControl m) => Int -> Double -> m a -> m a -- | Like waitUntil, but retries the action until it fails or until -- the timeout is exceeded. waitWhile :: (WDSessionStateControl m) => Double -> m a -> m () -- | Like waitUntil', but retries the action until it either fails -- or until the timeout is exceeded. waitWhile' :: (WDSessionStateControl m) => Int -> Double -> m a -> m () -- | An exception representing the 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 :: MonadBaseControl IO m => Bool -> m () -- | throws ExpectFailed. This is nice for writing your own -- abstractions. unexpected :: MonadBaseControl IO m => String -> m a -- | Apply a monadic predicate to every element in a list, and -- expect that at least one succeeds. expectAny :: (Foldable f, MonadBaseControl IO m) => (a -> m Bool) -> f a -> m () -- | Apply a monadic predicate to every element in a list, and -- expect that all succeed. expectAll :: (Foldable f, MonadBaseControl IO m) => (a -> m Bool) -> f a -> m () -- | expect the given Element to not be stale and returns it expectNotStale :: WebDriver wd => Element -> wd Element -- | expect an alert to be present on the page, and returns its -- text. expectAlertOpen :: WebDriver wd => wd Text -- | Catches any FailedCommand exceptions with the given -- FailedCommandType and rethrows as ExpectFailed catchFailedCommand :: MonadBaseControl IO m => FailedCommandType -> m a -> m a -- | Convenience function to catch FailedCommand Timeout -- exceptions and perform some action. -- -- Example: -- --
-- waitUntil 5 (getText <=< findElem $ ByCSS ".class") -- `onTimeout` return "" --onTimeout :: MonadBaseControl IO m => m a -> m a -> m a instance GHC.Classes.Eq Test.WebDriver.Commands.Wait.ExpectFailed instance GHC.Show.Show Test.WebDriver.Commands.Wait.ExpectFailed instance GHC.Exception.Exception Test.WebDriver.Commands.Wait.ExpectFailed module Test.WebDriver.Config -- | WebDriver session configuration data WDConfig WDConfig :: String -> Int -> Capabilities -> String -> RequestHeaders -> RequestHeaders -> SessionHistoryConfig -> Maybe Manager -> Int -> WDConfig -- | Host name of the WebDriver server for this session (default 127.0.0.1) [wdHost] :: WDConfig -> String -- | Port number of the server (default 4444) [wdPort] :: WDConfig -> Int -- | Capabilities to use for this session [wdCapabilities] :: WDConfig -> Capabilities -- | Base path for all API requests (default "/wd/hub") [wdBasePath] :: WDConfig -> String -- | Custom request headers to add to every HTTP request. [wdRequestHeaders] :: WDConfig -> RequestHeaders -- | Custom request headers to add *only* to session creation requests. -- This is usually done when a WebDriver server requires HTTP auth. [wdAuthHeaders] :: WDConfig -> RequestHeaders -- | Specifies behavior of HTTP request/response history. By default we use -- unlimitedHistory. [wdHistoryConfig] :: WDConfig -> SessionHistoryConfig -- | Use the given http-client Manager instead of automatically -- creating one. [wdHTTPManager] :: WDConfig -> Maybe Manager -- | Number of times to retry a HTTP request if it times out (default 0) [wdHTTPRetryCount] :: WDConfig -> Int -- | A default session config connects to localhost on port 4444, and -- hasn't been initialized server-side. This value is the same as -- def but with a less polymorphic type. defaultConfig :: WDConfig -- | Modifies the wdCapabilities field of a WDConfig by -- applying the given function. Overloaded to work with any -- HasCapabilities instance. modifyCaps :: HasCapabilities t => (Capabilities -> Capabilities) -> t -> t -- | A helper function for setting the browser capability of a -- HasCapabilities instance useBrowser :: HasCapabilities t => Browser -> t -> t -- | A helper function for setting the version capability of a -- HasCapabilities instance useVersion :: HasCapabilities t => String -> t -> t -- | A helper function for setting the platform capability of a -- HasCapabilities instance usePlatform :: HasCapabilities t => Platform -> t -> t -- | A helper function for setting the useProxy capability of a -- HasCapabilities instance useProxy :: HasCapabilities t => ProxyType -> t -> t -- | A function used by wdHistoryConfig to append new entries to -- session history. type SessionHistoryConfig = SessionHistory -> [SessionHistory] -> [SessionHistory] -- | No session history is saved. noHistory :: SessionHistoryConfig -- | Keep unlimited history unlimitedHistory :: SessionHistoryConfig -- | Saves only the most recent history onlyMostRecentHistory :: SessionHistoryConfig -- | Class of types that can configure a WebDriver session. class WebDriverConfig c -- | Produces a Capabilities from the given configuration. mkCaps :: (WebDriverConfig c, MonadBase IO m) => c -> m Capabilities -- | Produces a WDSession from the given configuration. mkSession :: (WebDriverConfig c, MonadBase IO m) => c -> m WDSession instance Test.WebDriver.Capabilities.GetCapabilities Test.WebDriver.Config.WDConfig instance Test.WebDriver.Capabilities.SetCapabilities Test.WebDriver.Config.WDConfig instance Data.Default.Class.Default Test.WebDriver.Config.WDConfig instance Test.WebDriver.Config.WebDriverConfig Test.WebDriver.Config.WDConfig module Test.WebDriver.Monad -- | A state monad for WebDriver commands. newtype WD a WD :: (StateT WDSession IO a) -> WD a -- | Executes a WD computation within the IO monad, using the -- given WDSession as state for WebDriver requests. runWD :: WDSession -> WD a -> IO a -- | 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 --runSession :: WebDriverConfig conf => conf -> WD a -> IO a -- | A finalizer ensuring that the session is always closed at the end of -- the given WD action, regardless of any exceptions. finallyClose :: WebDriver wd => wd a -> wd a -- | Exception handler that closes the session when an asynchronous -- exception is thrown, but otherwise leaves the session open if the -- action was successful. closeOnException :: WebDriver wd => wd a -> wd a -- | Gets the command history for the current session. getSessionHistory :: WDSessionState wd => wd [SessionHistory] -- | Prints a history of API requests to stdout after computing the given -- action. dumpSessionHistory :: WDSessionStateControl wd => wd a -> wd a instance Control.Monad.Fix.MonadFix Test.WebDriver.Monad.WD instance Control.Monad.Catch.MonadCatch Test.WebDriver.Monad.WD instance Control.Monad.Catch.MonadThrow Test.WebDriver.Monad.WD instance Control.Monad.IO.Class.MonadIO Test.WebDriver.Monad.WD instance GHC.Base.Monad Test.WebDriver.Monad.WD instance GHC.Base.Applicative Test.WebDriver.Monad.WD instance GHC.Base.Functor Test.WebDriver.Monad.WD instance Control.Monad.Base.MonadBase GHC.Types.IO Test.WebDriver.Monad.WD instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Test.WebDriver.Monad.WD instance Test.WebDriver.Session.WDSessionState Test.WebDriver.Monad.WD instance Test.WebDriver.Class.WebDriver Test.WebDriver.Monad.WD module Test.WebDriver.Types -- | A state monad for WebDriver commands. newtype WD a WD :: (StateT WDSession IO a) -> WD a -- | The local state of a WebDriver session. This structure is passed -- implicitly through all WD computations data WDSession WDSession :: ByteString -> Int -> ByteString -> Maybe SessionId -> [SessionHistory] -> SessionHistoryConfig -> Manager -> Int -> RequestHeaders -> RequestHeaders -> WDSession [wdSessHost] :: WDSession -> ByteString [wdSessPort] :: WDSession -> Int [wdSessBasePath] :: WDSession -> ByteString -- | 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 [wdSessId] :: WDSession -> Maybe SessionId -- | The complete history of HTTP requests and responses, most recent -- first. [wdSessHist] :: WDSession -> [SessionHistory] -- | Update function used to append new entries to session history [wdSessHistUpdate] :: WDSession -> SessionHistoryConfig -- | HTTP Manager used for connection pooling by the http-client -- library. [wdSessHTTPManager] :: WDSession -> Manager -- | Number of times to retry a HTTP request if it times out [wdSessHTTPRetryCount] :: WDSession -> Int -- | Custom request headers to add to every HTTP request. [wdSessRequestHeaders] :: WDSession -> RequestHeaders -- | Custom request headers to add *only* to session creation requests. -- This is usually done when a WebDriver server requires HTTP auth. [wdSessAuthHeaders] :: WDSession -> RequestHeaders -- | 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 data SessionHistory -- | WebDriver session configuration data WDConfig WDConfig :: String -> Int -> Capabilities -> String -> RequestHeaders -> RequestHeaders -> SessionHistoryConfig -> Maybe Manager -> Int -> WDConfig -- | Host name of the WebDriver server for this session (default 127.0.0.1) [wdHost] :: WDConfig -> String -- | Port number of the server (default 4444) [wdPort] :: WDConfig -> Int -- | Capabilities to use for this session [wdCapabilities] :: WDConfig -> Capabilities -- | Base path for all API requests (default "/wd/hub") [wdBasePath] :: WDConfig -> String -- | Custom request headers to add to every HTTP request. [wdRequestHeaders] :: WDConfig -> RequestHeaders -- | Custom request headers to add *only* to session creation requests. -- This is usually done when a WebDriver server requires HTTP auth. [wdAuthHeaders] :: WDConfig -> RequestHeaders -- | Specifies behavior of HTTP request/response history. By default we use -- unlimitedHistory. [wdHistoryConfig] :: WDConfig -> SessionHistoryConfig -- | Use the given http-client Manager instead of automatically -- creating one. [wdHTTPManager] :: WDConfig -> Maybe Manager -- | Number of times to retry a HTTP request if it times out (default 0) [wdHTTPRetryCount] :: WDConfig -> Int -- | A default session config connects to localhost on port 4444, and -- hasn't been initialized server-side. This value is the same as -- def but with a less polymorphic type. defaultConfig :: WDConfig -- | A function used by wdHistoryConfig to append new entries to -- session history. type SessionHistoryConfig = SessionHistory -> [SessionHistory] -> [SessionHistory] -- | A structure describing the capabilities of a session. This record -- serves dual roles. -- --
-- runSessionThenClose action = runSession myConfig . finallyClose $ action --runSession :: WebDriverConfig conf => conf -> WD a -> IO a -- | 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. withSession :: WDSessionStateControl m => WDSession -> m a -> m a -- | Executes a WD computation within the IO monad, using the -- given WDSession as state for WebDriver requests. runWD :: WDSession -> WD a -> IO a -- | WebDriver session configuration data WDConfig WDConfig :: String -> Int -> Capabilities -> String -> RequestHeaders -> RequestHeaders -> SessionHistoryConfig -> Maybe Manager -> Int -> WDConfig -- | Host name of the WebDriver server for this session (default 127.0.0.1) [wdHost] :: WDConfig -> String -- | Port number of the server (default 4444) [wdPort] :: WDConfig -> Int -- | Capabilities to use for this session [wdCapabilities] :: WDConfig -> Capabilities -- | Base path for all API requests (default "/wd/hub") [wdBasePath] :: WDConfig -> String -- | Custom request headers to add to every HTTP request. [wdRequestHeaders] :: WDConfig -> RequestHeaders -- | Custom request headers to add *only* to session creation requests. -- This is usually done when a WebDriver server requires HTTP auth. [wdAuthHeaders] :: WDConfig -> RequestHeaders -- | Specifies behavior of HTTP request/response history. By default we use -- unlimitedHistory. [wdHistoryConfig] :: WDConfig -> SessionHistoryConfig -- | Use the given http-client Manager instead of automatically -- creating one. [wdHTTPManager] :: WDConfig -> Maybe Manager -- | Number of times to retry a HTTP request if it times out (default 0) [wdHTTPRetryCount] :: WDConfig -> Int -- | A default session config connects to localhost on port 4444, and -- hasn't been initialized server-side. This value is the same as -- def but with a less polymorphic type. defaultConfig :: WDConfig -- | A helper function for setting the browser capability of a -- HasCapabilities instance useBrowser :: HasCapabilities t => Browser -> t -> t -- | A helper function for setting the useProxy capability of a -- HasCapabilities instance useProxy :: HasCapabilities t => ProxyType -> t -> t -- | A helper function for setting the version capability of a -- HasCapabilities instance useVersion :: HasCapabilities t => String -> t -> t -- | A helper function for setting the platform capability of a -- HasCapabilities instance usePlatform :: HasCapabilities t => Platform -> t -> t -- | A function used by wdHistoryConfig to append new entries to -- session history. type SessionHistoryConfig = SessionHistory -> [SessionHistory] -> [SessionHistory] -- | No session history is saved. noHistory :: SessionHistoryConfig -- | Keep unlimited history unlimitedHistory :: SessionHistoryConfig -- | Saves only the most recent history onlyMostRecentHistory :: SessionHistoryConfig -- | Set a temporary list of custom RequestHeaders to use within the -- given action. All previous custom headers are temporarily removed, and -- then restored at the end. withRequestHeaders :: WDSessionStateControl m => RequestHeaders -> m a -> m a -- | Makes all webdriver HTTP requests in the given action use the -- session's auth headers, typically configured by setting the -- wdAuthHeaders config. This is useful if you want to -- temporarily use the same auth headers you used for session creation -- with other HTTP requests. withAuthHeaders :: WDSessionStateControl m => m a -> m a -- | A structure describing the capabilities of a session. This record -- serves dual roles. -- --