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.
- runIsolated :: Monad m => Capabilities -> WebDriverT m a -> WebDriverT m ()
- newSession :: Monad m => Capabilities -> WebDriverT m SessionId
- newSession' :: Monad m => (Value -> Value) -> Capabilities -> WebDriverT m SessionId
- deleteSession :: Monad m => WebDriverT m ()
- sessionStatus :: Monad m => WebDriverT m (Bool, String)
- getTimeouts :: Monad m => WebDriverT m TimeoutConfig
- setTimeouts :: Monad m => TimeoutConfig -> WebDriverT m ()
- navigateTo :: Monad m => Url -> WebDriverT m ()
- navigateToStealth :: Monad m => Url -> WebDriverT m ()
- getCurrentUrl :: Monad m => WebDriverT m Url
- goBack :: Monad m => WebDriverT m ()
- goForward :: Monad m => WebDriverT m ()
- pageRefresh :: Monad m => WebDriverT m ()
- getTitle :: Monad m => WebDriverT m String
- getWindowHandle :: Monad m => WebDriverT m ContextId
- closeWindow :: Monad m => WebDriverT m [ContextId]
- switchToWindow :: (Monad m, HasContextId t) => t -> WebDriverT m ()
- getWindowHandles :: Monad m => WebDriverT m [ContextId]
- switchToFrame :: Monad m => FrameReference -> WebDriverT m ()
- switchToParentFrame :: Monad m => WebDriverT m ()
- getWindowRect :: Monad m => WebDriverT m Rect
- setWindowRect :: Monad m => Rect -> WebDriverT m Rect
- maximizeWindow :: Monad m => WebDriverT m Rect
- minimizeWindow :: Monad m => WebDriverT m Rect
- fullscreenWindow :: Monad m => WebDriverT m Rect
- findElement :: Monad m => LocationStrategy -> Selector -> WebDriverT m ElementRef
- findElements :: Monad m => LocationStrategy -> Selector -> WebDriverT m [ElementRef]
- findElementFromElement :: (Monad m, HasElementRef t) => LocationStrategy -> Selector -> t -> WebDriverT m ElementRef
- findElementsFromElement :: (Monad m, HasElementRef t) => LocationStrategy -> Selector -> t -> WebDriverT m [ElementRef]
- getActiveElement :: Monad m => WebDriverT m ElementRef
- isElementSelected :: (Monad m, HasElementRef t) => t -> WebDriverT m Bool
- getElementAttribute :: (Monad m, HasElementRef t) => t -> AttributeName -> WebDriverT m (Either Bool String)
- getElementProperty :: (Monad m, HasElementRef t) => t -> PropertyName -> WebDriverT m Value
- getElementCssValue :: (Monad m, HasElementRef t) => t -> CssPropertyName -> WebDriverT m String
- getElementText :: (Monad m, HasElementRef t) => t -> WebDriverT m String
- getElementTagName :: (Monad m, HasElementRef t) => t -> WebDriverT m String
- getElementRect :: (Monad m, HasElementRef t) => t -> WebDriverT m Rect
- isElementEnabled :: (Monad m, HasElementRef t) => t -> WebDriverT m Bool
- elementClick :: (Monad m, HasElementRef t) => t -> WebDriverT m ()
- elementClear :: (Monad m, HasElementRef t) => t -> WebDriverT m ()
- elementSendKeys :: (Monad m, HasElementRef t) => t -> String -> WebDriverT m ()
- getPageSource :: Monad m => WebDriverT m String
- getPageSourceStealth :: Monad m => WebDriverT m String
- executeScript :: Monad m => Script -> [Value] -> WebDriverT m Value
- executeAsyncScript :: Monad m => Script -> [Value] -> WebDriverT m Value
- getAllCookies :: Monad m => WebDriverT m [Cookie]
- getNamedCookie :: Monad m => CookieName -> WebDriverT m Cookie
- addCookie :: Monad m => Cookie -> WebDriverT m ()
- deleteCookie :: Monad m => CookieName -> WebDriverT m ()
- deleteAllCookies :: Monad m => WebDriverT m ()
- performActions :: Monad m => [Action] -> WebDriverT m ()
- performActionsStealth :: Monad m => [Action] -> WebDriverT m ()
- releaseActions :: Monad m => WebDriverT m ()
- dismissAlert :: Monad m => WebDriverT m ()
- acceptAlert :: Monad m => WebDriverT m ()
- getAlertText :: Monad m => WebDriverT m (Maybe String)
- sendAlertText :: Monad m => String -> WebDriverT m ()
- takeScreenshot :: Monad m => WebDriverT m ByteString
- takeElementScreenshot :: (Monad m, HasElementRef t) => t -> WebDriverT m ByteString
- _WEB_ELEMENT_ID :: Text
- _WEB_WINDOW_ID :: Text
- _WEB_FRAME_ID :: Text
Documentation
runIsolated :: Monad m => Capabilities -> WebDriverT m a -> WebDriverT m () 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 m => Capabilities -> WebDriverT m 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 m => (Value -> Value) -> Capabilities -> WebDriverT m 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 m => WebDriverT m () Source #
Status
sessionStatus :: Monad m => WebDriverT m (Bool, String) Source #
Get Timeouts
getTimeouts :: Monad m => WebDriverT m TimeoutConfig Source #
Set Timeouts
setTimeouts :: Monad m => TimeoutConfig -> WebDriverT m () Source #
Navigation
Navigate To
navigateTo :: Monad m => Url -> WebDriverT m () 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 m => Url -> WebDriverT m () 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 m => WebDriverT m Url Source #
Go Back
goBack :: Monad m => WebDriverT m () Source #
Go Forward
goForward :: Monad m => WebDriverT m () Source #
Page Refresh
pageRefresh :: Monad m => WebDriverT m () Source #
Get Title
Command Contexts
Get Window Handle
getWindowHandle :: Monad m => WebDriverT m ContextId Source #
Close Window
closeWindow :: Monad m => WebDriverT m [ContextId] Source #
Switch To Window
switchToWindow :: (Monad m, HasContextId t) => t -> WebDriverT m () Source #
Get Window Handles
getWindowHandles :: Monad m => WebDriverT m [ContextId] Source #
Switch To Frame
switchToFrame :: Monad m => FrameReference -> WebDriverT m () Source #
Switch To Parent Frame
switchToParentFrame :: Monad m => WebDriverT m () Source #
Get Window Rect
getWindowRect :: Monad m => WebDriverT m Rect Source #
Set Window Rect
setWindowRect :: Monad m => Rect -> WebDriverT m Rect Source #
Maximize Window
maximizeWindow :: Monad m => WebDriverT m Rect Source #
Minimize Window
minimizeWindow :: Monad m => WebDriverT m Rect Source #
Fullscreen Window
fullscreenWindow :: Monad m => WebDriverT m Rect Source #
Element Retrieval
Find Element
findElement :: Monad m => LocationStrategy -> Selector -> WebDriverT m ElementRef Source #
Find Elements
findElements :: Monad m => LocationStrategy -> Selector -> WebDriverT m [ElementRef] Source #
Find Element From Element
findElementFromElement :: (Monad m, HasElementRef t) => LocationStrategy -> Selector -> t -> WebDriverT m ElementRef Source #
Find Elements From Element
findElementsFromElement :: (Monad m, HasElementRef t) => LocationStrategy -> Selector -> t -> WebDriverT m [ElementRef] Source #
Get Active Element
getActiveElement :: Monad m => WebDriverT m ElementRef Source #
Element State
Is Element Selected
isElementSelected :: (Monad m, HasElementRef t) => t -> WebDriverT m Bool Source #
Get Element Attribute
getElementAttribute :: (Monad m, HasElementRef t) => t -> AttributeName -> WebDriverT m (Either Bool String) Source #
Get Element Property
getElementProperty :: (Monad m, HasElementRef t) => t -> PropertyName -> WebDriverT m Value Source #
Get Element CSS Value
getElementCssValue :: (Monad m, HasElementRef t) => t -> CssPropertyName -> WebDriverT m String Source #
Get Element Text
getElementText :: (Monad m, HasElementRef t) => t -> WebDriverT m String Source #
Get Element Tag Name
getElementTagName :: (Monad m, HasElementRef t) => t -> WebDriverT m String Source #
Get Element Rect
getElementRect :: (Monad m, HasElementRef t) => t -> WebDriverT m Rect Source #
Is Element Enabled
isElementEnabled :: (Monad m, HasElementRef t) => t -> WebDriverT m Bool Source #
Element Interaction
Element Click
elementClick :: (Monad m, HasElementRef t) => t -> WebDriverT m () Source #
Element Clear
elementClear :: (Monad m, HasElementRef t) => t -> WebDriverT m () Source #
Element Send Keys
elementSendKeys :: (Monad m, HasElementRef t) => t -> String -> WebDriverT m () Source #
Document Handling
Get Page Source
getPageSource :: Monad m => WebDriverT m String Source #
getPageSourceStealth :: Monad m => WebDriverT m 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 m => Script -> [Value] -> WebDriverT m Value Source #
Execute Async Script
executeAsyncScript :: Monad m => Script -> [Value] -> WebDriverT m Value Source #
Cookies
Get All Cookies
getAllCookies :: Monad m => WebDriverT m [Cookie] Source #
Get Named Cookie
getNamedCookie :: Monad m => CookieName -> WebDriverT m Cookie Source #
Add Cookie
Delete Cookie
deleteCookie :: Monad m => CookieName -> WebDriverT m () Source #
Delete All Cookies
deleteAllCookies :: Monad m => WebDriverT m () Source #
Actions
Perform Actions
performActions :: Monad m => [Action] -> WebDriverT m () 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 m => [Action] -> WebDriverT m () 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 m => WebDriverT m () Source #
User Prompts
Dismiss Alert
dismissAlert :: Monad m => WebDriverT m () Source #
Accept Alert
acceptAlert :: Monad m => WebDriverT m () Source #
Get Alert Text
getAlertText :: Monad m => WebDriverT m (Maybe String) Source #
Send Alert Text
sendAlertText :: Monad m => String -> WebDriverT m () Source #
Screen Capture
Take Screenshot
takeScreenshot :: Monad m => WebDriverT m ByteString Source #
Take Element Screenshot
takeElementScreenshot :: (Monad m, HasElementRef t) => t -> WebDriverT m 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.