| 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 = Text
- newtype ElementRef = ElementRef {}
- newtype ContextId = ContextId {
- theContextId :: Text
- data ContextType
- type Selector = Text
- type AttributeName = Text
- type PropertyName = Text
- type AriaRole = Text
- type AriaLabel = Text
- type Script = Text
- type CookieName = Text
- type CssPropertyName = Text
- data FrameReference
- data Capabilities = Capabilities {
- _browserName :: Maybe BrowserName
- _browserVersion :: Maybe Text
- _platformName :: Maybe PlatformName
- _acceptInsecureCerts :: Maybe Bool
- _pageLoadStrategy :: Maybe Text
- _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 [Text]
- _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 PrintOptions = PrintOptions {
- _orientation :: Maybe Orientation
- _scale :: Maybe Scale
- _background :: Maybe Bool
- _page :: Maybe Page
- _margin :: Maybe Margin
- _shrinkToFit :: Maybe Bool
- _pageRanges :: Maybe [PageRange]
- defaultPrintOptions :: PrintOptions
- data Orientation
- newtype Scale = Scale Scientific
- data Page = Page {}
- defaultPage :: Page
- data Margin = Margin {}
- defaultMargin :: Margin
- data PageRange
- newtype Base64EncodedPdf = Base64EncodedPdf ByteString
- decodeBase64EncodedPdf :: Base64EncodedPdf -> ByteString
- writeBase64EncodedPdf :: MonadIO m => FilePath -> Base64EncodedPdf -> m ()
- data LocationStrategy
- data Rect = Rect {}
- emptyRect :: Rect
- data PromptHandler
- data Cookie = Cookie {}
- cookie :: Text -> Text -> 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
| |
Instances
| Eq ContextId Source # | |
| Show ContextId Source # | |
| IsString ContextId Source # | |
Defined in Web.Api.WebDriver.Types Methods fromString :: String -> ContextId # | |
| Arbitrary ContextId Source # | |
| ToJSON ContextId Source # | |
Defined in Web.Api.WebDriver.Types | |
| FromJSON ContextId Source # | |
| HasContextId ContextId Source # | |
Defined in Web.Api.WebDriver.Classes Methods contextIdOf :: ContextId -> ContextId Source # | |
data ContextType Source #
Type of a top level browsing context; see https://html.spec.whatwg.org/#top-level-browsing-context.
Constructors
| WindowContext | |
| TabContext |
Instances
For use with a Locator Strategy. See https://w3c.github.io/webdriver/webdriver-spec.html#locator-strategies.
type AttributeName = Text Source #
Used with getElementAttribute.
type PropertyName = Text Source #
Used with getElementProperty.
type CookieName = Text Source #
Used with getNamedCookie.
type CssPropertyName = Text 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.
data PrintOptions Source #
Constructors
| PrintOptions | |
Fields
| |
Instances
| Eq PrintOptions Source # | |
Defined in Web.Api.WebDriver.Types | |
| Show PrintOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> PrintOptions -> ShowS # show :: PrintOptions -> String # showList :: [PrintOptions] -> ShowS # | |
| Arbitrary PrintOptions Source # | |
Defined in Web.Api.WebDriver.Types | |
| ToJSON PrintOptions Source # | |
Defined in Web.Api.WebDriver.Types Methods toJSON :: PrintOptions -> Value # toEncoding :: PrintOptions -> Encoding # toJSONList :: [PrintOptions] -> Value # toEncodingList :: [PrintOptions] -> Encoding # | |
| FromJSON PrintOptions Source # | |
Defined in Web.Api.WebDriver.Types | |
data Orientation Source #
Instances
Constructors
| Scale Scientific |
Constructors
| Page | |
Fields
| |
defaultPage :: Page Source #
Constructors
| Margin | |
Fields
| |
newtype Base64EncodedPdf Source #
Constructors
| Base64EncodedPdf ByteString |
Instances
| Eq Base64EncodedPdf Source # | |
Defined in Web.Api.WebDriver.Types Methods (==) :: Base64EncodedPdf -> Base64EncodedPdf -> Bool # (/=) :: Base64EncodedPdf -> Base64EncodedPdf -> Bool # | |
| Show Base64EncodedPdf Source # | |
Defined in Web.Api.WebDriver.Types Methods showsPrec :: Int -> Base64EncodedPdf -> ShowS # show :: Base64EncodedPdf -> String # showList :: [Base64EncodedPdf] -> ShowS # | |
| FromJSON Base64EncodedPdf Source # | |
Defined in Web.Api.WebDriver.Types Methods parseJSON :: Value -> Parser Base64EncodedPdf # parseJSONList :: Value -> Parser [Base64EncodedPdf] # | |
writeBase64EncodedPdf :: MonadIO m => FilePath -> Base64EncodedPdf -> m () Source #
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
| |
All members other than name and value set to Nothing.
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] # | |