HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

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 declarations

A 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).

See https://www.w3.org/TR/webdriver1/#sessions.

datadata Timeouts
#

Constructors

Instances4Eq, Show, FromJSON, ToJSON
  • Eq TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Sessions
  • Show TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Sessions
  • FromJSON TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Sessions
  • ToJSON TimeoutsDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Sessions

Navigation

6 declarations

The 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.

See https://www.w3.org/TR/webdriver1/#navigation.

Command contexts

14 declarations

Many 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.

See https://www.w3.org/TR/webdriver1/#command-contexts.

datadata FrameSelector
#

Specifies the frame used by focusFrame

Constructors

Instances4Eq, Read, Show, ToJSON
  • Eq FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • Read FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • Show FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • ToJSON FrameSelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
datadata Rect
#
Instances5Eq, Ord, Show, FromJSON, ToJSON
  • Eq RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • Ord RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • Show RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • FromJSON RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
  • ToJSON RectDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.CommandContexts
newtypenewtype WindowHandle
#

An opaque identifier for a browser window

Constructors

Instances6Eq, Ord, Read, Show, FromJSON, ToJSON

Element Retrieval

7 declarations

The 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.

See https://www.w3.org/TR/webdriver1/#element-retrieval.

datadata Selector
#

Specifies element(s) within a DOM tree using various selection methods.

Instances4Eq, Ord, Show, ToJSON
  • Eq SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrieval
  • Ord SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrieval
  • Show SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrieval
  • ToJSON SelectorDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.ElementRetrieval
newtypenewtype Element
#

An opaque identifier for a web page element

Constructors

Instances6Eq, Ord, Read, Show, FromJSON, ToJSON
  • Eq ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
  • Ord ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
  • Read ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
  • Show ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
  • FromJSON ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands
  • ToJSON ElementDefined in webdriver-0.15.0.0 · Test.WebDriver.Util.Commands

Element State

8 declarations

Element Interaction

3 declarations

Document handling

5 declarations
valueasyncJS
  1. :: (HasCallStack, Foldable f, FromJSON a, WebDriver wd)
  2. => f JSArg
  3. -> Text
  4. -> wd (Maybe 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)

valueexecuteJS
  1. :: (HasCallStack, Foldable f, FromJSON a, WebDriver wd)
  2. => f JSArg
  3. -> Text
  4. -> wd a
#

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
datadata JSArg
#

An existential wrapper for any ToJSON instance. This allows us to pass parameters of many different types to Javascript code.

Constructors

Instances1ToJSON
  • ToJSON JSArgDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.DocumentHandling

Cookies

7 declarations
valuemkCookie :: Text -> Text -> Cookie
#

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.

valuesetCookie :: (HasCallStack, WebDriver wd) => Cookie -> wd ()
#

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.

datadata Cookie
#

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

Instances6Eq, Show, Generic, FromJSON, ToJSON, Rep

Actions

13 declarations
datadata MouseButton
#
Instances7Bounded, Enum, Eq, Ord, Show, FromJSON, …
  • Bounded MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
  • Enum MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
  • Eq MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
  • Ord MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
  • Show MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
  • FromJSON MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions
  • ToJSON MouseButtonDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Actions

User Prompts

4 declarations

Screen capture

3 declarations

Browser logs

6 declarations

Retrieve browser console logs and other log types.

valuegetLogs :: (HasCallStack, WebDriver wd) => LogType -> wd [LogEntry]
#

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.

datadata LogEntry
#

A record that represents a single log entry.

Constructors

Instances6Eq, Ord, Read, Show, FromJSON, ToJSON
  • Eq LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Ord LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Read LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Show LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • FromJSON LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • ToJSON LogEntryDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
datadata LogLevel
#
Instances8Bounded, Enum, Eq, Ord, Read, Show, …
  • Bounded LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Enum LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Eq LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Ord LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Read LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • Show LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • FromJSON LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common
  • ToJSON LogLevelDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.Logs.Common

BiDi sessions (experimental)

6 declarations

Low-level BiDi session establishment.

Network activity (experimental)

17 declarations

Use BiDi to track network activity events.

datadata RequestInfo
#
Instances2Eq, Show
  • Eq RequestInfoDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.BiDi.NetworkActivity
  • Show RequestInfoDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.BiDi.NetworkActivity

Selenium-specific

0 declarations

Mobile device support

valuetouchFlick :: (HasCallStack, WebDriver wd) => (Int, Int) -> 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.

datadata Orientation
#

A screen orientation

Instances7Bounded, Enum, Eq, Ord, Show, FromJSON, …
  • Bounded OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
  • Enum OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
  • Eq OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
  • Ord OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
  • Show OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
  • FromJSON OrientationDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.Mobile
  • ToJSON 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.

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

valuegetKey :: (HasCallStack, WebDriver wd) => WebStorageType -> Text -> wd Text
#

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.

Instances8Bounded, Enum, Eq, Ord, Read, Show, …
datadata WebStorageType
#

An HTML 5 storage type

Instances5Bounded, Enum, Eq, Ord, Show
  • Bounded WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5
  • Enum WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5
  • Eq WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5
  • Ord WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5
  • Show WebStorageTypeDefined in webdriver-0.15.0.0 · Test.WebDriver.Commands.SeleniumSpecific.HTML5

Misc