Copyright | 2018 Automattic Inc. |
---|---|
License | GPL-3 |
Maintainer | Nathan Bloomfield (nbloomf@gmail.com) |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
The WebDriver protocol involves passing several different kinds of JSON objects. We can encode these as types to make our DSL more robust; this module is a grab bag of these types. For each one we need ToJSON
and FromJSON
instances, and sometimes also a default value.
Note that while the WebDriver spec defines some JSON objects, in general a given WebDriver server can accept additional properties on any given object. Our types here will be limited to the "spec" object signatures, but our API will need to be user extensible.
- type SessionId = String
- newtype ElementRef = ElementRef {}
- newtype ContextId = ContextId {}
- type Selector = String
- type AttributeName = String
- type PropertyName = String
- type Script = String
- type CookieName = String
- type CssPropertyName = String
- data FrameReference
- data Capabilities = Capabilities {
- _browserName :: Maybe BrowserName
- _browserVersion :: Maybe String
- _platformName :: Maybe PlatformName
- _acceptInsecureCerts :: Maybe Bool
- _pageLoadStrategy :: Maybe String
- _proxy :: Maybe ProxyConfig
- _setWindowRect :: Maybe Bool
- _timeouts :: Maybe TimeoutConfig
- _unhandledPromptBehavior :: Maybe PromptHandler
- _chromeOptions :: Maybe ChromeOptions
- _firefoxOptions :: Maybe FirefoxOptions
- data BrowserName
- data PlatformName = Mac
- emptyCapabilities :: Capabilities
- defaultFirefoxCapabilities :: Capabilities
- headlessFirefoxCapabilities :: Capabilities
- defaultChromeCapabilities :: Capabilities
- data LogLevel
- data FirefoxOptions = FirefoxOptions {}
- newtype FirefoxLog = FirefoxLog {}
- defaultFirefoxOptions :: FirefoxOptions
- data ChromeOptions = ChromeOptions {
- _chromeBinary :: Maybe FilePath
- _chromeArgs :: Maybe [String]
- defaultChromeOptions :: ChromeOptions
- data ProxyConfig = ProxyConfig {}
- emptyProxyConfig :: ProxyConfig
- data ProxyType
- data HostAndOptionalPort = HostAndOptionalPort {}
- data TimeoutConfig = TimeoutConfig {}
- emptyTimeoutConfig :: TimeoutConfig
- data InputSource
- data PointerSubtype
- newtype InputSourceParameter = InputSourceParameter {}
- data Action = Action {}
- emptyAction :: Action
- data ActionType
- data ActionItem = ActionItem {}
- emptyActionItem :: ActionItem
- data LocationStrategy
- data Rect = Rect {}
- emptyRect :: Rect
- data PromptHandler
- data Cookie = Cookie {}
- emptyCookie :: Cookie
- data ResponseErrorCode
- = ElementClickIntercepted
- | ElementNotSelectable
- | ElementNotInteractable
- | InsecureCertificate
- | InvalidArgument
- | InvalidCookieDomain
- | InvalidCoordinates
- | InvalidElementState
- | InvalidSelector
- | InvalidSessionId
- | JavaScriptError
- | MoveTargetOutOfBounds
- | NoSuchAlert
- | NoSuchCookie
- | NoSuchElement
- | NoSuchFrame
- | NoSuchWindow
- | ScriptTimeout
- | SessionNotCreated
- | StaleElementReference
- | Timeout
- | UnableToSetCookie
- | UnableToCaptureScreen
- | UnexpectedAlertOpen
- | UnknownCommand
- | UnknownError
- | UnknownMethod
- | UnsupportedOperation
- | UnhandledErrorCode Text
Stringy Types
newtype ElementRef Source #
Identifier for a browsing context; see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-current-browsing-context.
type Selector = String Source #
For use with a Locator Strategy. See https://w3c.github.io/webdriver/webdriver-spec.html#locator-strategies.
type AttributeName = String Source #
Used with getElementAttribute
.
type PropertyName = String Source #
Used with getElementProperty
.
type CookieName = String Source #
Used with getNamedCookie
.
type CssPropertyName = String Source #
Used with getElementCssValue
.
data FrameReference Source #
Possible frame references; see https://w3c.github.io/webdriver/webdriver-spec.html#switch-to-frame.
Capabilities
data Capabilities Source #
Capabilities | |
|
data BrowserName Source #
Used in Capabilities
.
data PlatformName Source #
Used in Capabilities
.
emptyCapabilities :: Capabilities Source #
Capabilities
with all members set to Nothing
.
defaultFirefoxCapabilities :: Capabilities Source #
All members set to Nothing
except _browserName
, which is Just Firefox
.
headlessFirefoxCapabilities :: Capabilities Source #
Passing the "-headless" parameter to Firefox.
defaultChromeCapabilities :: Capabilities Source #
All members set to Nothing
except _browserName
, which is Just Chrome
.
data FirefoxOptions Source #
FirefoxOptions | |
|
newtype FirefoxLog Source #
defaultFirefoxOptions :: FirefoxOptions Source #
All members set to Nothing
.
data ChromeOptions Source #
ChromeOptions | |
|
defaultChromeOptions :: ChromeOptions Source #
All members set to Nothing
.
Proxy
data ProxyConfig Source #
ProxyConfig | |
|
emptyProxyConfig :: ProxyConfig Source #
ProxyConfig
object with all members set to Nothing
.
ProxyPac | pac |
ProxyDirect | direct |
ProxyAutodetect | autodetect |
ProxySystem | system |
ProxyManual | manual |
data HostAndOptionalPort Source #
Timeout
emptyTimeoutConfig :: TimeoutConfig Source #
TimeoutConfig
object with all members set to Nothing
.
Input and Actions
data InputSource Source #
NullInputSource | null |
KeyInputSource | key |
PointerInputSource | pointer |
data PointerSubtype Source #
PointerMouse | mouse |
PointerPen | pen |
PointerTouch | touch |
newtype InputSourceParameter Source #
Action | |
|
emptyAction :: Action Source #
All members set to Nothing
except _actionItems
, which is the empty list.
data ActionType Source #
PauseAction | pause |
KeyUpAction | keyUp |
KeyDownAction | keyDown |
PointerDownAction | pointerDown |
PointerUpAction | pointerUp |
PointerMoveAction | pointerMove |
PointerCancelAction | pointerCancel |
data ActionItem Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#dfn-process-an-input-source-action-sequence.
ActionItem | |
|
emptyActionItem :: ActionItem Source #
All members set to Nothing
.
Misc
data LocationStrategy Source #
CssSelector | css selector |
LinkTextSelector | link text |
PartialLinkTextSelector | partial link text |
TagName | tag name |
XPathSelector | xpath |
Rect | |
|
data PromptHandler Source #
DismissPrompts | dismiss |
AcceptPrompts | accept |
DismissPromptsAndNotify | dismiss and notify |
AcceptPromptsAndNotify | accept and notify |
IgnorePrompts | ignore |
Cookie | |
|
emptyCookie :: Cookie Source #
All members set to Nothing
.
Error Responses
data ResponseErrorCode Source #
Semantic HTTP error responses. See https://w3c.github.io/webdriver/webdriver-spec.html#locator-strategies.