Copyright | 2018 Automattic Inc. |
---|---|
License | GPL-3 |
Maintainer | Nathan Bloomfield (nbloomf@gmail.com) |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Web.Api.WebDriver.Types
Description
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 #
Constructors
ElementRef | |
Fields |
Instances
Eq ElementRef Source # | |
Defined in Web.Api.WebDriver.Types | |
Show ElementRef Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> ElementRef -> ShowS # show :: ElementRef -> String # showList :: [ElementRef] -> ShowS # | |
IsString ElementRef Source # | |
Defined in Web.Api.WebDriver.Types Methods fromString :: String -> ElementRef # | |
HasElementRef ElementRef Source # | |
Defined in Web.Api.WebDriver.Classes Methods elementRefOf :: ElementRef -> ElementRef Source # |
Identifier for a browsing context; see https://w3c.github.io/webdriver/webdriver-spec.html#dfn-current-browsing-context.
Constructors
ContextId | |
Fields |
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.
Constructors
TopLevelFrame | |
FrameNumber Int | |
FrameContainingElement ElementRef |
Instances
Eq FrameReference Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: FrameReference -> FrameReference -> Bool # (/=) :: FrameReference -> FrameReference -> Bool # | |
Show FrameReference Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> FrameReference -> ShowS # show :: FrameReference -> String # showList :: [FrameReference] -> ShowS # |
Capabilities
data Capabilities Source #
Constructors
Capabilities | |
Fields
|
Instances
Eq Capabilities Source # | |
Defined in Web.Api.WebDriver.Types | |
Show Capabilities Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> Capabilities -> ShowS # show :: Capabilities -> String # showList :: [Capabilities] -> ShowS # | |
Arbitrary Capabilities Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON Capabilities Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: Capabilities -> Value # toEncoding :: Capabilities -> Encoding # toJSONList :: [Capabilities] -> Value # toEncodingList :: [Capabilities] -> Encoding # | |
FromJSON Capabilities Source # | |
Defined in Web.Api.WebDriver.Types |
data BrowserName Source #
Used in Capabilities
.
Instances
data PlatformName Source #
Used in Capabilities
.
Constructors
Mac |
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
Bounded LogLevel Source # | |
Enum LogLevel Source # | |
Defined in Web.Api.WebDriver.Types | |
Eq LogLevel Source # | |
Show LogLevel Source # | |
Arbitrary LogLevel Source # | |
ToJSON LogLevel Source # | |
Defined in Web.Api.WebDriver.Types | |
FromJSON LogLevel Source # | |
data FirefoxOptions Source #
Constructors
FirefoxOptions | |
Fields
|
Instances
Eq FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: FirefoxOptions -> FirefoxOptions -> Bool # (/=) :: FirefoxOptions -> FirefoxOptions -> Bool # | |
Show FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> FirefoxOptions -> ShowS # show :: FirefoxOptions -> String # showList :: [FirefoxOptions] -> ShowS # | |
Arbitrary FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: FirefoxOptions -> Value # toEncoding :: FirefoxOptions -> Encoding # toJSONList :: [FirefoxOptions] -> Value # toEncodingList :: [FirefoxOptions] -> Encoding # | |
FromJSON FirefoxOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods parseJSON :: Value -> Parser FirefoxOptions # parseJSONList :: Value -> Parser [FirefoxOptions] # |
newtype FirefoxLog Source #
Constructors
FirefoxLog | |
Fields |
Instances
Eq FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types | |
Show FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> FirefoxLog -> ShowS # show :: FirefoxLog -> String # showList :: [FirefoxLog] -> ShowS # | |
Arbitrary FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: FirefoxLog -> Value # toEncoding :: FirefoxLog -> Encoding # toJSONList :: [FirefoxLog] -> Value # toEncodingList :: [FirefoxLog] -> Encoding # | |
FromJSON FirefoxLog Source # | |
Defined in Web.Api.WebDriver.Types |
defaultFirefoxOptions :: FirefoxOptions Source #
All members set to Nothing
.
data ChromeOptions Source #
Constructors
ChromeOptions | |
Fields
|
Instances
Eq ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: ChromeOptions -> ChromeOptions -> Bool # (/=) :: ChromeOptions -> ChromeOptions -> Bool # | |
Show ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> ChromeOptions -> ShowS # show :: ChromeOptions -> String # showList :: [ChromeOptions] -> ShowS # | |
Arbitrary ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: ChromeOptions -> Value # toEncoding :: ChromeOptions -> Encoding # toJSONList :: [ChromeOptions] -> Value # toEncodingList :: [ChromeOptions] -> Encoding # | |
FromJSON ChromeOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods parseJSON :: Value -> Parser ChromeOptions # parseJSONList :: Value -> Parser [ChromeOptions] # |
defaultChromeOptions :: ChromeOptions Source #
All members set to Nothing
.
Proxy
data ProxyConfig Source #
Constructors
ProxyConfig | |
Fields
|
Instances
Eq ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types | |
Show ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> ProxyConfig -> ShowS # show :: ProxyConfig -> String # showList :: [ProxyConfig] -> ShowS # | |
Arbitrary ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: ProxyConfig -> Value # toEncoding :: ProxyConfig -> Encoding # toJSONList :: [ProxyConfig] -> Value # toEncodingList :: [ProxyConfig] -> Encoding # | |
FromJSON ProxyConfig Source # | |
Defined in Web.Api.WebDriver.Types |
emptyProxyConfig :: ProxyConfig Source #
ProxyConfig
object with all members set to Nothing
.
Constructors
ProxyPac | pac |
ProxyDirect | direct |
ProxyAutodetect | autodetect |
ProxySystem | system |
ProxyManual | manual |
Instances
Bounded ProxyType Source # | |
Enum ProxyType Source # | |
Defined in Web.Api.WebDriver.Types Methods 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 Methods (==) :: HostAndOptionalPort -> HostAndOptionalPort -> Bool # (/=) :: HostAndOptionalPort -> HostAndOptionalPort -> Bool # | |
Show HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> HostAndOptionalPort -> ShowS # show :: HostAndOptionalPort -> String # showList :: [HostAndOptionalPort] -> ShowS # | |
Arbitrary HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types Methods | |
ToJSON HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: HostAndOptionalPort -> Value # toEncoding :: HostAndOptionalPort -> Encoding # toJSONList :: [HostAndOptionalPort] -> Value # toEncodingList :: [HostAndOptionalPort] -> Encoding # | |
FromJSON HostAndOptionalPort Source # | |
Defined in Web.Api.WebDriver.Types Methods parseJSON :: Value -> Parser HostAndOptionalPort # parseJSONList :: Value -> Parser [HostAndOptionalPort] # |
Timeout
data TimeoutConfig Source #
Constructors
TimeoutConfig | |
Instances
Eq TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: TimeoutConfig -> TimeoutConfig -> Bool # (/=) :: TimeoutConfig -> TimeoutConfig -> Bool # | |
Show TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> TimeoutConfig -> ShowS # show :: TimeoutConfig -> String # showList :: [TimeoutConfig] -> ShowS # | |
Arbitrary TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: TimeoutConfig -> Value # toEncoding :: TimeoutConfig -> Encoding # toJSONList :: [TimeoutConfig] -> Value # toEncodingList :: [TimeoutConfig] -> Encoding # | |
FromJSON TimeoutConfig Source # | |
Defined in Web.Api.WebDriver.Types Methods 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 #
Constructors
NullInputSource | null |
KeyInputSource | key |
PointerInputSource | pointer |
Instances
data PointerSubtype Source #
Constructors
PointerMouse | mouse |
PointerPen | pen |
PointerTouch | touch |
Instances
newtype InputSourceParameter Source #
Constructors
InputSourceParameter | |
Fields
|
Instances
Eq InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: InputSourceParameter -> InputSourceParameter -> Bool # (/=) :: InputSourceParameter -> InputSourceParameter -> Bool # | |
Show InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> InputSourceParameter -> ShowS # show :: InputSourceParameter -> String # showList :: [InputSourceParameter] -> ShowS # | |
Arbitrary InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types Methods | |
ToJSON InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: InputSourceParameter -> Value # toEncoding :: InputSourceParameter -> Encoding # toJSONList :: [InputSourceParameter] -> Value # toEncodingList :: [InputSourceParameter] -> Encoding # | |
FromJSON InputSourceParameter Source # | |
Defined in Web.Api.WebDriver.Types Methods parseJSON :: Value -> Parser InputSourceParameter # parseJSONList :: Value -> Parser [InputSourceParameter] # |
Constructors
Action | |
Fields
|
emptyAction :: Action Source #
All members set to Nothing
except _actionItems
, which is the empty list.
data ActionType Source #
Constructors
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.
Constructors
ActionItem | |
Fields
|
Instances
Eq ActionItem Source # | |
Defined in Web.Api.WebDriver.Types | |
Show ActionItem Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> ActionItem -> ShowS # show :: ActionItem -> String # showList :: [ActionItem] -> ShowS # | |
Arbitrary ActionItem Source # | |
Defined in Web.Api.WebDriver.Types | |
ToJSON ActionItem Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: ActionItem -> Value # toEncoding :: ActionItem -> Encoding # toJSONList :: [ActionItem] -> Value # toEncodingList :: [ActionItem] -> Encoding # | |
FromJSON ActionItem Source # | |
Defined in Web.Api.WebDriver.Types |
emptyActionItem :: ActionItem Source #
All members set to Nothing
.
Misc
data LocationStrategy Source #
Constructors
CssSelector | css selector |
LinkTextSelector | link text |
PartialLinkTextSelector | partial link text |
TagName | tag name |
XPathSelector | xpath |
Instances
Constructors
Rect | |
Fields
|
data PromptHandler Source #
Constructors
DismissPrompts | dismiss |
AcceptPrompts | accept |
DismissPromptsAndNotify | dismiss and notify |
AcceptPromptsAndNotify | accept and notify |
IgnorePrompts | ignore |
Instances
Constructors
Cookie | |
Fields
|
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.
Constructors
Instances
Eq ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: ResponseErrorCode -> ResponseErrorCode -> Bool # (/=) :: ResponseErrorCode -> ResponseErrorCode -> Bool # | |
Show ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types Methods 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 Methods toJSON :: ResponseErrorCode -> Value # toEncoding :: ResponseErrorCode -> Encoding # toJSONList :: [ResponseErrorCode] -> Value # toEncodingList :: [ResponseErrorCode] -> Encoding # | |
FromJSON ResponseErrorCode Source # | |
Defined in Web.Api.WebDriver.Types Methods parseJSON :: Value -> Parser ResponseErrorCode # parseJSONList :: Value -> Parser [ResponseErrorCode] # |