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.
Synopsis
- 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]
- _chromePrefs :: Maybe (HashMap Text Value)
- 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 #
Instances
Eq ElementRef Source # | |
Defined in Web.Api.WebDriver.Types (==) :: ElementRef -> ElementRef -> Bool # (/=) :: ElementRef -> ElementRef -> Bool # | |
Show ElementRef Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> ElementRef -> ShowS # show :: ElementRef -> String # showList :: [ElementRef] -> ShowS # | |
IsString ElementRef Source # | |
Defined in Web.Api.WebDriver.Types fromString :: String -> ElementRef # | |
HasElementRef ElementRef Source # | |
Defined in Web.Api.WebDriver.Classes elementRefOf :: ElementRef -> 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.
Instances
Eq FrameReference Source # | |
Defined in Web.Api.WebDriver.Types (==) :: FrameReference -> FrameReference -> Bool # (/=) :: FrameReference -> FrameReference -> Bool # | |
Show FrameReference Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> FrameReference -> ShowS # show :: FrameReference -> String # showList :: [FrameReference] -> ShowS # |
Capabilities
data Capabilities Source #
Capabilities | |
|
Instances
Eq Capabilities Source # | |
Defined in Web.Api.WebDriver.Types (==) :: Capabilities -> Capabilities -> Bool # (/=) :: Capabilities -> Capabilities -> Bool # | |
Show Capabilities Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> Capabilities -> ShowS # show :: Capabilities -> String # showList :: [Capabilities] -> ShowS # | |
Arbitrary Capabilities Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen Capabilities # shrink :: Capabilities -> [Capabilities] # | |
ToJSON Capabilities Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: Capabilities -> Value # toEncoding :: Capabilities -> Encoding # toJSONList :: [Capabilities] -> Value # toEncodingList :: [Capabilities] -> Encoding # | |
FromJSON Capabilities Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser Capabilities # parseJSONList :: Value -> Parser [Capabilities] # |
data BrowserName Source #
Used in Capabilities
.
Instances
data PlatformName Source #
Used in Capabilities
.
Instances
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
.
Instances
data FirefoxOptions Source #
FirefoxOptions | |
|
Instances
Eq FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types (==) :: FirefoxOptions -> FirefoxOptions -> Bool # (/=) :: FirefoxOptions -> FirefoxOptions -> Bool # | |
Show FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> FirefoxOptions -> ShowS # show :: FirefoxOptions -> String # showList :: [FirefoxOptions] -> ShowS # | |
Arbitrary FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen FirefoxOptions # shrink :: FirefoxOptions -> [FirefoxOptions] # | |
ToJSON FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: FirefoxOptions -> Value # toEncoding :: FirefoxOptions -> Encoding # toJSONList :: [FirefoxOptions] -> Value # toEncodingList :: [FirefoxOptions] -> Encoding # | |
FromJSON FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser FirefoxOptions # parseJSONList :: Value -> Parser [FirefoxOptions] # |
newtype FirefoxLog Source #
Instances
Eq FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types (==) :: FirefoxLog -> FirefoxLog -> Bool # (/=) :: FirefoxLog -> FirefoxLog -> Bool # | |
Show FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> FirefoxLog -> ShowS # show :: FirefoxLog -> String # showList :: [FirefoxLog] -> ShowS # | |
Arbitrary FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen FirefoxLog # shrink :: FirefoxLog -> [FirefoxLog] # | |
ToJSON FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: FirefoxLog -> Value # toEncoding :: FirefoxLog -> Encoding # toJSONList :: [FirefoxLog] -> Value # toEncodingList :: [FirefoxLog] -> Encoding # | |
FromJSON FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser FirefoxLog # parseJSONList :: Value -> Parser [FirefoxLog] # |
defaultFirefoxOptions :: FirefoxOptions Source #
All members set to Nothing
.
data ChromeOptions Source #
ChromeOptions | |
|
Instances
Eq ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types (==) :: ChromeOptions -> ChromeOptions -> Bool # (/=) :: ChromeOptions -> ChromeOptions -> Bool # | |
Show ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> ChromeOptions -> ShowS # show :: ChromeOptions -> String # showList :: [ChromeOptions] -> ShowS # | |
Arbitrary ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen ChromeOptions # shrink :: ChromeOptions -> [ChromeOptions] # | |
ToJSON ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: ChromeOptions -> Value # toEncoding :: ChromeOptions -> Encoding # toJSONList :: [ChromeOptions] -> Value # toEncodingList :: [ChromeOptions] -> Encoding # | |
FromJSON ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser ChromeOptions # parseJSONList :: Value -> Parser [ChromeOptions] # |
defaultChromeOptions :: ChromeOptions Source #
All members set to Nothing
.
Proxy
data ProxyConfig Source #
ProxyConfig | |
|
Instances
Eq ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types (==) :: ProxyConfig -> ProxyConfig -> Bool # (/=) :: ProxyConfig -> ProxyConfig -> Bool # | |
Show ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> ProxyConfig -> ShowS # show :: ProxyConfig -> String # showList :: [ProxyConfig] -> ShowS # | |
Arbitrary ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen ProxyConfig # shrink :: ProxyConfig -> [ProxyConfig] # | |
ToJSON ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: ProxyConfig -> Value # toEncoding :: ProxyConfig -> Encoding # toJSONList :: [ProxyConfig] -> Value # toEncodingList :: [ProxyConfig] -> Encoding # | |
FromJSON ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser ProxyConfig # parseJSONList :: Value -> Parser [ProxyConfig] # |
emptyProxyConfig :: ProxyConfig Source #
ProxyConfig
object with all members set to Nothing
.
ProxyPac | pac |
ProxyDirect | direct |
ProxyAutodetect | autodetect |
ProxySystem | system |
ProxyManual | manual |
Instances
Bounded ProxyType Source # | |
Enum ProxyType Source # | |
Defined in Web.Api.WebDriver.Types succ :: ProxyType -> ProxyType # pred :: ProxyType -> ProxyType # fromEnum :: ProxyType -> Int # enumFrom :: ProxyType -> [ProxyType] # enumFromThen :: ProxyType -> ProxyType -> [ProxyType] # enumFromTo :: ProxyType -> ProxyType -> [ProxyType] # enumFromThenTo :: ProxyType -> ProxyType -> ProxyType -> [ProxyType] # | |
Eq ProxyType Source # | |
Show ProxyType Source # | |
Arbitrary ProxyType Source # | |
ToJSON ProxyType Source # | |
Defined in Web.Api.WebDriver.Types | |
FromJSON ProxyType Source # | |
data HostAndOptionalPort Source #
Instances
Eq HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types (==) :: HostAndOptionalPort -> HostAndOptionalPort -> Bool # (/=) :: HostAndOptionalPort -> HostAndOptionalPort -> Bool # | |
Show HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> HostAndOptionalPort -> ShowS # show :: HostAndOptionalPort -> String # showList :: [HostAndOptionalPort] -> ShowS # | |
Arbitrary HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: HostAndOptionalPort -> Value # toEncoding :: HostAndOptionalPort -> Encoding # toJSONList :: [HostAndOptionalPort] -> Value # toEncodingList :: [HostAndOptionalPort] -> Encoding # | |
FromJSON HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser HostAndOptionalPort # parseJSONList :: Value -> Parser [HostAndOptionalPort] # |
Timeout
data TimeoutConfig Source #
Instances
Eq TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types (==) :: TimeoutConfig -> TimeoutConfig -> Bool # (/=) :: TimeoutConfig -> TimeoutConfig -> Bool # | |
Show TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> TimeoutConfig -> ShowS # show :: TimeoutConfig -> String # showList :: [TimeoutConfig] -> ShowS # | |
Arbitrary TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen TimeoutConfig # shrink :: TimeoutConfig -> [TimeoutConfig] # | |
ToJSON TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: TimeoutConfig -> Value # toEncoding :: TimeoutConfig -> Encoding # toJSONList :: [TimeoutConfig] -> Value # toEncodingList :: [TimeoutConfig] -> Encoding # | |
FromJSON TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser TimeoutConfig # parseJSONList :: Value -> Parser [TimeoutConfig] # |
emptyTimeoutConfig :: TimeoutConfig Source #
TimeoutConfig
object with all members set to Nothing
.
Input and Actions
data InputSource Source #
NullInputSource | null |
KeyInputSource | key |
PointerInputSource | pointer |
Instances
data PointerSubtype Source #
PointerMouse | mouse |
PointerPen | pen |
PointerTouch | touch |
Instances
newtype InputSourceParameter Source #
Instances
Eq InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types (==) :: InputSourceParameter -> InputSourceParameter -> Bool # (/=) :: InputSourceParameter -> InputSourceParameter -> Bool # | |
Show InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> InputSourceParameter -> ShowS # show :: InputSourceParameter -> String # showList :: [InputSourceParameter] -> ShowS # | |
Arbitrary InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: InputSourceParameter -> Value # toEncoding :: InputSourceParameter -> Encoding # toJSONList :: [InputSourceParameter] -> Value # toEncodingList :: [InputSourceParameter] -> Encoding # | |
FromJSON InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser InputSourceParameter # parseJSONList :: Value -> Parser [InputSourceParameter] # |
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 |
Instances
data ActionItem Source #
See https://w3c.github.io/webdriver/webdriver-spec.html#dfn-process-an-input-source-action-sequence.
ActionItem | |
|
Instances
Eq ActionItem Source # | |
Defined in Web.Api.WebDriver.Types (==) :: ActionItem -> ActionItem -> Bool # (/=) :: ActionItem -> ActionItem -> Bool # | |
Show ActionItem Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> ActionItem -> ShowS # show :: ActionItem -> String # showList :: [ActionItem] -> ShowS # | |
Arbitrary ActionItem Source # | |
Defined in Web.Api.WebDriver.Types arbitrary :: Gen ActionItem # shrink :: ActionItem -> [ActionItem] # | |
ToJSON ActionItem Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: ActionItem -> Value # toEncoding :: ActionItem -> Encoding # toJSONList :: [ActionItem] -> Value # toEncodingList :: [ActionItem] -> Encoding # | |
FromJSON ActionItem Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser ActionItem # parseJSONList :: Value -> Parser [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 |
Instances
Rect | |
|
data PromptHandler Source #
DismissPrompts | dismiss |
AcceptPrompts | accept |
DismissPromptsAndNotify | dismiss and notify |
AcceptPromptsAndNotify | accept and notify |
IgnorePrompts | ignore |
Instances
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.
Instances
Eq ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types (==) :: ResponseErrorCode -> ResponseErrorCode -> Bool # (/=) :: ResponseErrorCode -> ResponseErrorCode -> Bool # | |
Show ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types showsPrec :: Int -> ResponseErrorCode -> ShowS # show :: ResponseErrorCode -> String # showList :: [ResponseErrorCode] -> ShowS # | |
Arbitrary ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types toJSON :: ResponseErrorCode -> Value # toEncoding :: ResponseErrorCode -> Encoding # toJSONList :: [ResponseErrorCode] -> Value # toEncodingList :: [ResponseErrorCode] -> Encoding # | |
FromJSON ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types parseJSON :: Value -> Parser ResponseErrorCode # parseJSONList :: Value -> Parser [ResponseErrorCode] # |