Copyright | 2018 Automattic Inc. |
---|---|
License | GPL-3 |
Maintainer | Nathan Bloomfield (nbloomf@gmail.com) |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
These bindings try to stick as closely to the spec as possible. We use the following conventions.
- The
Stealth
suffix on a function indicates that it does not log request or response data (but it does log that a request/response occurred). - A prime (
'
) on a POST function name indicates that it takes an additional function parameter that mutates the payload after it is converted to JSON, but before sending the request. This is a cheap way to future-proof the bindings and accommodate nonstandard request parameters.
The most recent version of the spec is available at https://w3c.github.io/webdriver/webdriver-spec.html.
Synopsis
- runIsolated :: (Monad eff, Monad (t eff), MonadTrans t) => Capabilities -> WebDriverTT t eff a -> WebDriverTT t eff ()
- newSession :: (Monad eff, Monad (t eff), MonadTrans t) => Capabilities -> WebDriverTT t eff SessionId
- newSession' :: (Monad eff, Monad (t eff), MonadTrans t) => (Value -> Value) -> Capabilities -> WebDriverTT t eff SessionId
- deleteSession :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- sessionStatus :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff (Bool, String)
- getTimeouts :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff TimeoutConfig
- setTimeouts :: (Monad eff, Monad (t eff), MonadTrans t) => TimeoutConfig -> WebDriverTT t eff ()
- navigateTo :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> WebDriverTT t eff ()
- navigateToStealth :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> WebDriverTT t eff ()
- getCurrentUrl :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Url
- goBack :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- goForward :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- pageRefresh :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- getTitle :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff String
- getWindowHandle :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ContextId
- closeWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff [ContextId]
- switchToWindow :: (Monad eff, Monad (t eff), MonadTrans t, HasContextId a) => a -> WebDriverTT t eff ()
- getWindowHandles :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff [ContextId]
- switchToFrame :: (Monad eff, Monad (t eff), MonadTrans t) => FrameReference -> WebDriverTT t eff ()
- switchToParentFrame :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- getWindowRect :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect
- setWindowRect :: (Monad eff, Monad (t eff), MonadTrans t) => Rect -> WebDriverTT t eff Rect
- maximizeWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect
- minimizeWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect
- fullscreenWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect
- findElement :: (Monad eff, Monad (t eff), MonadTrans t) => LocationStrategy -> Selector -> WebDriverTT t eff ElementRef
- findElements :: (Monad eff, Monad (t eff), MonadTrans t) => LocationStrategy -> Selector -> WebDriverTT t eff [ElementRef]
- findElementFromElement :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => LocationStrategy -> Selector -> a -> WebDriverTT t eff ElementRef
- findElementsFromElement :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => LocationStrategy -> Selector -> a -> WebDriverTT t eff [ElementRef]
- getActiveElement :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ElementRef
- isElementSelected :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff Bool
- getElementAttribute :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => AttributeName -> a -> WebDriverTT t eff (Either Bool String)
- getElementProperty :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => PropertyName -> a -> WebDriverTT t eff Value
- getElementCssValue :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => CssPropertyName -> a -> WebDriverTT t eff String
- getElementText :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff String
- getElementTagName :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff String
- getElementRect :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff Rect
- isElementEnabled :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff Bool
- elementClick :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff ()
- elementClear :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff ()
- elementSendKeys :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => String -> a -> WebDriverTT t eff ()
- getPageSource :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff String
- getPageSourceStealth :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff String
- executeScript :: (Monad eff, Monad (t eff), MonadTrans t) => Script -> [Value] -> WebDriverTT t eff Value
- executeAsyncScript :: (Monad eff, Monad (t eff), MonadTrans t) => Script -> [Value] -> WebDriverTT t eff Value
- getAllCookies :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff [Cookie]
- getNamedCookie :: (Monad eff, Monad (t eff), MonadTrans t) => CookieName -> WebDriverTT t eff Cookie
- addCookie :: (Monad eff, Monad (t eff), MonadTrans t) => Cookie -> WebDriverTT t eff ()
- deleteCookie :: (Monad eff, Monad (t eff), MonadTrans t) => CookieName -> WebDriverTT t eff ()
- deleteAllCookies :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- performActions :: (Monad eff, Monad (t eff), MonadTrans t) => [Action] -> WebDriverTT t eff ()
- performActionsStealth :: (Monad eff, Monad (t eff), MonadTrans t) => [Action] -> WebDriverTT t eff ()
- releaseActions :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- dismissAlert :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- acceptAlert :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ()
- getAlertText :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff (Maybe String)
- sendAlertText :: (Monad eff, Monad (t eff), MonadTrans t) => String -> WebDriverTT t eff ()
- takeScreenshot :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ByteString
- takeElementScreenshot :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff ByteString
- _WEB_ELEMENT_ID :: Text
- _WEB_WINDOW_ID :: Text
- _WEB_FRAME_ID :: Text
Documentation
runIsolated :: (Monad eff, Monad (t eff), MonadTrans t) => Capabilities -> WebDriverTT t eff a -> WebDriverTT t eff () Source #
Run a WebDriver computation in an isolated browser session. Ensures that the session is closed on the remote end.
Sessions
New Session
newSession :: (Monad eff, Monad (t eff), MonadTrans t) => Capabilities -> WebDriverTT t eff SessionId Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#new-session. For an extensible version allowing arbitrary changes to the JSON value representing the Capabilities
parameter, see newSession'
.
newSession' :: (Monad eff, Monad (t eff), MonadTrans t) => (Value -> Value) -> Capabilities -> WebDriverTT t eff SessionId Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#new-session. This generalizes newSession'
by taking an additional function Value -> Value
that is applied to the Capabilities
parameter after it is converted to JSON, but before it is passed to the HTTP call.
Delete Session
deleteSession :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Status
sessionStatus :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff (Bool, String) Source #
Get Timeouts
getTimeouts :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff TimeoutConfig Source #
Set Timeouts
setTimeouts :: (Monad eff, Monad (t eff), MonadTrans t) => TimeoutConfig -> WebDriverTT t eff () Source #
Navigation
Navigate To
navigateTo :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> WebDriverTT t eff () Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#navigate-to. To access this enpoint without logging the request or the result, use navigateToStealth
.
navigateToStealth :: (Monad eff, Monad (t eff), MonadTrans t) => Url -> WebDriverTT t eff () Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#navigate-to. This function does not log the request or response; if you do want the interaction logged, use navigateTo
.
Get Current URL
getCurrentUrl :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Url Source #
Go Back
goBack :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Go Forward
goForward :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Page Refresh
pageRefresh :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Get Title
getTitle :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff String Source #
Command Contexts
Get Window Handle
getWindowHandle :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ContextId Source #
Close Window
closeWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff [ContextId] Source #
Switch To Window
switchToWindow :: (Monad eff, Monad (t eff), MonadTrans t, HasContextId a) => a -> WebDriverTT t eff () Source #
Get Window Handles
getWindowHandles :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff [ContextId] Source #
Switch To Frame
switchToFrame :: (Monad eff, Monad (t eff), MonadTrans t) => FrameReference -> WebDriverTT t eff () Source #
Switch To Parent Frame
switchToParentFrame :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Get Window Rect
getWindowRect :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect Source #
Set Window Rect
setWindowRect :: (Monad eff, Monad (t eff), MonadTrans t) => Rect -> WebDriverTT t eff Rect Source #
Maximize Window
maximizeWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect Source #
Minimize Window
minimizeWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect Source #
Fullscreen Window
fullscreenWindow :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff Rect Source #
Element Retrieval
Find Element
findElement :: (Monad eff, Monad (t eff), MonadTrans t) => LocationStrategy -> Selector -> WebDriverTT t eff ElementRef Source #
Find Elements
findElements :: (Monad eff, Monad (t eff), MonadTrans t) => LocationStrategy -> Selector -> WebDriverTT t eff [ElementRef] Source #
Find Element From Element
findElementFromElement :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => LocationStrategy -> Selector -> a -> WebDriverTT t eff ElementRef Source #
Find Elements From Element
findElementsFromElement :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => LocationStrategy -> Selector -> a -> WebDriverTT t eff [ElementRef] Source #
Get Active Element
getActiveElement :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ElementRef Source #
Element State
Is Element Selected
isElementSelected :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff Bool Source #
Get Element Attribute
getElementAttribute :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => AttributeName -> a -> WebDriverTT t eff (Either Bool String) Source #
Get Element Property
getElementProperty :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => PropertyName -> a -> WebDriverTT t eff Value Source #
Get Element CSS Value
getElementCssValue :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => CssPropertyName -> a -> WebDriverTT t eff String Source #
Get Element Text
getElementText :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff String Source #
Get Element Tag Name
getElementTagName :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff String Source #
Get Element Rect
getElementRect :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff Rect Source #
Is Element Enabled
isElementEnabled :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff Bool Source #
Element Interaction
Element Click
elementClick :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff () Source #
Element Clear
elementClear :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff () Source #
Element Send Keys
elementSendKeys :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => String -> a -> WebDriverTT t eff () Source #
Document Handling
Get Page Source
getPageSource :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff String Source #
getPageSourceStealth :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff String Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#get-page-source. Does not dump the page source into the logs. :)
Execute Script
executeScript :: (Monad eff, Monad (t eff), MonadTrans t) => Script -> [Value] -> WebDriverTT t eff Value Source #
Execute Async Script
executeAsyncScript :: (Monad eff, Monad (t eff), MonadTrans t) => Script -> [Value] -> WebDriverTT t eff Value Source #
Cookies
Get All Cookies
getAllCookies :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff [Cookie] Source #
Get Named Cookie
getNamedCookie :: (Monad eff, Monad (t eff), MonadTrans t) => CookieName -> WebDriverTT t eff Cookie Source #
Add Cookie
addCookie :: (Monad eff, Monad (t eff), MonadTrans t) => Cookie -> WebDriverTT t eff () Source #
Delete Cookie
deleteCookie :: (Monad eff, Monad (t eff), MonadTrans t) => CookieName -> WebDriverTT t eff () Source #
Delete All Cookies
deleteAllCookies :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Actions
Perform Actions
performActions :: (Monad eff, Monad (t eff), MonadTrans t) => [Action] -> WebDriverTT t eff () Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#perform-actions. For a variant on this endpoint that does not log the request and response, see performActionsStealth
.
performActionsStealth :: (Monad eff, Monad (t eff), MonadTrans t) => [Action] -> WebDriverTT t eff () Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#perform-actions. This function is identical to performActions
except that it does not log the request or response. Handy if the action includes secret info.
Release Actions
releaseActions :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
User Prompts
Dismiss Alert
dismissAlert :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Accept Alert
acceptAlert :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff () Source #
Get Alert Text
getAlertText :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff (Maybe String) Source #
Send Alert Text
sendAlertText :: (Monad eff, Monad (t eff), MonadTrans t) => String -> WebDriverTT t eff () Source #
Screen Capture
Take Screenshot
takeScreenshot :: (Monad eff, Monad (t eff), MonadTrans t) => WebDriverTT t eff ByteString Source #
Take Element Screenshot
takeElementScreenshot :: (Monad eff, Monad (t eff), MonadTrans t, HasElementRef a) => a -> WebDriverTT t eff ByteString Source #
_WEB_ELEMENT_ID :: Text Source #
Spec-defined "web element identifier" string constant. See https://w3c.github.io/webdriver/webdriver-spec.html#elements.
_WEB_WINDOW_ID :: Text Source #
Spec-defined "web window identifier" string constant. See https://w3c.github.io/webdriver/webdriver-spec.html#command-contexts.
_WEB_FRAME_ID :: Text Source #
Spec-defined "web frame identifier" string constant. See https://w3c.github.io/webdriver/webdriver-spec.html#command-contexts.