Modulewebdriver-0.15.0.0Haskell2010
Test.WebDriver.Commands
This module exports all the actions that can be used to interact with a browser session.
- 25 types
- 113 values
- Packagewebdriver-0.15.0.0
- Exports138
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCommands.hs
Sessions
8 declarationsA session is equivalent to a single instantiation of a particular user agent, including all its child browsers. WebDriver gives each session a unique session ID that can be used to differentiate one session from another, allowing multiple user agents to be controlled from a single HTTP server, and allowing sessions to be routed via a multiplexer (known as an intermediary node).
Get all the Timeouts simultaneously.
Get information from the server as a JSON Object. For more information about this object see https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#status
Set the "implicit" value of the Timeouts.
Set the "pageLoad" value of the Timeouts.
Set the "script" value of the Timeouts.
Selenium 3 and 4 accept null for this value, which unsets it. The spec doesn't mention this.
Set all the Timeouts simultaneously.
Constructors
TimeoutstimeoutsScript :: Maybe IntegerDetermines when to interrupt a script that is being evaluated.
timeoutsPageLoad :: Maybe IntegerProvides the timeout limit used to interrupt navigation of the browsing context.
timeoutsImplicit :: Maybe IntegerGives the timeout of when to abort locating an element.
Instances4Eq, Show, FromJSON, ToJSON
Eq TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SessionsShow TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SessionsFromJSON TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SessionsToJSON TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Sessions
Navigation
6 declarationsThe commands in this section allow navigation of the current top-level browsing context to new URLs and introspection of the document currently loaded in this browsing context.
Navigate backward in the browser history.
Navigate forward in the browser history.
Gets the URL of the current page.
Get the title of the current page.
Opens a new page by the given URL.
Refresh the current page
Command contexts
14 declarationsMany WebDriver commands happen in the context of either the current browsing context or current top-level browsing context. The current top-level browsing context is represented in the protocol by its associated window handle. When a top-level browsing context is selected using the Switch To Window command, a specific browsing context can be selected using the Switch to Frame command.
Closes the given window
Switch focus to the frame specified by the FrameSelector.
Switch focus to the frame specified by the FrameSelector.
Switch to a given window
Fullscreens the current window
Returns a handle to the currently focused window
Get the dimensions of the current window.
Maximizes the current window
Minimizes the current window
Set the dimensions of the current window.
Returns a list of all windows available to the session
Specifies the frame used by focusFrame
Constructors
WithIndex IntegerWithName TextFocus on a frame by name or ID
WithElement ElementFocus on a frame Element
DefaultFrameFocus on the first frame, or the main document if iframes are used.
Instances4Eq, Read, Show, ToJSON
Eq FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsRead FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsShow FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsToJSON FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
Instances5Eq, Ord, Show, FromJSON, ToJSON
Eq RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsOrd RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsShow RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsFromJSON RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContextsToJSON RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
An opaque identifier for a browser window
Constructors
Instances6Eq, Ord, Read, Show, FromJSON, ToJSON
Eq WindowHandleDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsOrd WindowHandleDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsRead WindowHandleDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsShow WindowHandleDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsFromJSON WindowHandleDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsToJSON WindowHandleDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
Element Retrieval
7 declarationsThe Find Element, Find Elements, Find Element From Element, and Find Elements From Element commands allow lookup of individual elements and collections of elements. Element retrieval searches are performed using pre-order traversal of the document’s nodes that match the provided selector’s expression. Elements are serialized and returned as web elements.
Return the element that currently has focus.
Find an element on the page using the given element selector.
Search for an element using the given element as root.
Find all elements on the page matching the given selector.
Find all elements matching a selector, using the given element as root.
Specifies element(s) within a DOM tree using various selection methods.
Constructors
Instances4Eq, Ord, Show, ToJSON
Eq SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrievalOrd SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrievalShow SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrievalToJSON SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrieval
Instances6Eq, Ord, Read, Show, FromJSON, ToJSON
Eq ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsOrd ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsRead ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsShow ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsFromJSON ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.CommandsToJSON ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
Element State
8 declarationsRetrieve the value of an element's attribute
Retrieve the value of an element's computed CSS property
Retrieve an element's current position.
Get all visible text within this element.
Determine if the element is enabled.
Determine if the element is selected.
Retrieve the value of an element's property
Return the tag name of the given element.
Element Interaction
3 declarationsClear a textarea or text input element's value.
Click on an element.
Send a sequence of keystrokes to an element. All modifier keys are released at the end of the function. Named constants for special modifier keys can be found in Test.WebDriver.Keys
Document handling
5 declarationsExecutes 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)
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 a sequence of 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.
When using executeJS, GHC might complain about an ambiguous type in situations where the result of the executeJS call is ignored/discard. Consider the following example:
jsExample = do
e <- findElem (ByCSS "#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 (ByCSS "#foo")
ignoreReturn $ executeJS [] "someAction()"
return e
Get the current page source
An existential wrapper for any ToJSON instance. This allows us to pass parameters of many different types to Javascript code.
Convenience function to ignore result of a webdriver command.
Cookies
7 declarationsRetrieve a specific cookie by name.
Retrieve all cookies.
Delete a cookie by name.
Delete all visible cookies on the current page.
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.
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.
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.
Constructors
CookiecookName :: TextcookValue :: TextcookPath :: Maybe TextPath of this cookie. If Nothing, defaults to /
cookDomain :: Maybe TextDomain of this cookie. If Nothing, the current page's domain is used.
cookSecure :: Maybe BoolIs this cookie secure?
cookExpiry :: Maybe DoubleExpiry date expressed as seconds since the Unix epoch. Nothing indicates that the cookie never expires.
Instances6Eq, Show, Generic, FromJSON, ToJSON, Rep
Eq CookieDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CookiesShow CookieDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CookiesGeneric CookieDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CookiesFromJSON CookieDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CookiesToJSON CookieDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Cookiestype Rep Cookie = D1 ('MetaDataDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Cookies"Cookie"
"Test.WebDriver.Commands.Cookies"
"webdriver-0.15.0.0-8iGJ14uG0FKFcqtsT3nZRp"
'False) (C1 ('MetaCons"Cookie"
'PrefixI 'True) ((S1 ('MetaSel ('Just"cookName"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: (S1 ('MetaSel ('Just"cookValue"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text) :*: S1 ('MetaSel ('Just"cookPath"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)))) :*: (S1 ('MetaSel ('Just"cookDomain"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Text)) :*: (S1 ('MetaSel ('Just"cookSecure"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Bool)) :*: S1 ('MetaSel ('Just"cookExpiry"
) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe Double))))))
Actions
13 declarationsHelper to click the center of an element.
Helper to double click the center of an element.
Moves the mouse to the given position relative to the current pointer position.
Moves the mouse to the center of a given element.
Moves the mouse to the given position relative to the given element.
Perform a sequence of actions from multiple input sources
Release all currently pressed keys and buttons
Generic action that can be pause, pointer, or key
Constructors
Action source (input device)
Instances2Eq, Show
Eq ActionSourceDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsShow ActionSourceDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
A mouse button
Instances7Bounded, Enum, Eq, Ord, Show, FromJSON, …
Bounded MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsEnum MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsEq MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsOrd MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsShow MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsFromJSON MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsToJSON MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
Individual pointer actions
Constructors
Instances2Eq, Show
Eq PointerActionDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsShow PointerActionDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
Origin for pointer actions
Constructors
Instances2Eq, Show
Eq PointerOriginDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ActionsShow PointerOriginDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
User Prompts
4 declarationsAccepts the currently displayed alert dialog.
Dismisses the currently displayed alert dialog.
Get the text of an alert dialog.
Sends keystrokes to Javascript prompt() dialog.
Screen capture
3 declarationsSave a screenshot to a particular location.
Grab a screenshot of the current page as a PNG image.
Grab a screenshot of the current page as a PNG image.
Browser logs
6 declarationsRetrieve browser console logs and other log types.
Retrieve logs of a specific type from the browser. The W3C spec doesn't define how to do this natively, so we automatically detect the browser and try to use an appropriate method:
Chrome/Chromium: Chrome DevTools Protocol (CDP)
Firefox: legacy log endpoint (/log)
Selenium: legacy log endpoint (/log)
Other browsers: returns empty list
Common log types: browser, driver, performance, server.
However, the modern way to do this is via withRecordLogsViaBiDi.
Wrapper around withRecordLogsViaBiDi' which uses the WebSocket URL from
the current Session. You must make sure to pass _capabilitiesWebSocketUrl
= Just True to enable this. This will not work with Selenium 3.
Connect to WebSocket URL and subscribe to log events using the W3C BiDi protocol; see https://w3c.github.io/webdriver-bidi/.
A record that represents a single log entry.
Instances6Eq, Ord, Read, Show, FromJSON, ToJSON
Eq LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonOrd LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonRead LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonShow LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonFromJSON LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonToJSON LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
Indicates a log verbosity level.
Instances8Bounded, Enum, Eq, Ord, Read, Show, …
Bounded LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonEnum LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonEq LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonOrd LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonRead LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonShow LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonFromJSON LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.CommonToJSON LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
BiDi sessions (experimental)
6 declarationsLow-level BiDi session establishment.
Default BiDi options.
Wrapper around withBiDiSession' which uses the WebSocket URL from
the current Session. You must make sure to pass _capabilitiesWebSocketUrl
= Just True to enable this. This will not work with Selenium 3.
Connect to WebSocket URL and subscribe to the given events using the W3C BiDi protocol; see https://w3c.github.io/webdriver-bidi/.
Constructors
Options controlling BiDi session establishment.
Constructors
Constructors
Instances2Show, FromJSON
Show BiDiResponseDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.BiDi.SessionFromJSON BiDiResponseDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.BiDi.Session
Network activity (experimental)
17 declarationsUse BiDi to track network activity events.
Read the current network activity map.
Wait for network to be idle (no pending requests).
Wait for network to be idle with a delay after the last activity This waits until:
There are no outstanding requests AND
No request has started or finished in the last time period given by the NominalDiffTime.
Wrapper around withRecordNetworkActivityViaBiDi' which uses the WebSocket URL from
the current Session. You must make sure to pass _capabilitiesWebSocketUrl
= Just True to enable this. This will not work with Selenium 3.
Connect to WebSocket URL and subscribe to network events using the W3C BiDi protocol; see https://w3c.github.io/webdriver-bidi/.
Instances2Eq, Show
Eq RequestInfoDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.BiDi.NetworkActivityShow RequestInfoDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.BiDi.NetworkActivity
Selenium-specific
0 declarationsMobile device support
Get the current geographical location of the device.
Get the current screen orientation for rotatable display devices.
Set the current geographical location of the device.
Set the current screen orientation for rotatable display devices.
Single tap on the touch screen at the given element's location.
Emulate a double click on a touch device.
Emulates pressing a finger down on the screen at the given location.
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.
touchFlickFrom Emulate a flick on the touch screen.
Emulate a long click on a touch device.
Emulates moving a finger on the screen to the given location.
Emulate finger-based touch scroll. Use this function if you don't care where the scroll begins
Emulate finger-based touch scroll, starting from the given location relative to the given element.
Emulates removing a finger from the screen at the given location.
Instances7Bounded, Enum, Eq, Ord, Show, FromJSON, …
Bounded OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.MobileEnum OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.MobileEq OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.MobileOrd OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.MobileShow OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.MobileFromJSON OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.MobileToJSON OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
Uploading files to remote server
These functions allow you to upload a file to a remote server. Note that this operation isn't supported by all WebDriver servers, and the location where the file is stored is not standardized.
Uploads a file from the local filesystem by its file path. Returns the remote filepath of the file.
seleniumUploadRawFile :: (HasCallStack, WebDriver wd)=> FilePathFile path to use with this bytestring.
-> IntegerModification time (in seconds since Unix epoch).
-> ByteStringThe file contents as a lazy ByteString.
-> wd Text
Uploads a raw ByteString with associated file info. Returns the remote filepath of the file.
Lowest level interface to the file uploading mechanism. This allows you to specify the exact details of the zip entry sent across network. Returns the remote filepath of the extracted file
HTML5
Delete all keys within a given web storage area.
Delete a key in the given web storage area.
Get a list of all keys from a web storage area.
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.
Set a key in the given web storage area.
Get the current number of keys in a web storage area.
Instances8Bounded, Enum, Eq, Ord, Read, Show, …
Bounded ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Enum ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Eq ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Ord ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Read ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Show ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5FromJSON ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5ToJSON ApplicationCacheStatusDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5
An HTML 5 storage type
Instances5Bounded, Enum, Eq, Ord, Show
Bounded WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Enum WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Eq WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Ord WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5Show WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5
Misc
Determines if two element identifiers refer to different elements.
Determines if two element identifiers refer to the same element.
Determine if the element is displayed. This function isn't guaranteed to be implemented by the WebDriver spec, but it is found in Selenium. See https://www.w3.org/TR/webdriver1/#element-displayedness.
Submit a form element. This may be applied to descendents of a form element as well.