{-# LANGUAGE CPP #-}
module WebDriverPreCore.HTTP.API
(
newSession,
status,
deleteSession,
getTimeouts,
setTimeouts,
navigateTo,
getCurrentUrl,
back,
forward,
refresh,
getTitle,
getWindowHandle,
newWindow,
closeWindow,
switchToWindow,
switchToFrame,
getPageSource,
executeScript,
executeScriptAsync,
addCookie,
getAllCookies,
getNamedCookie,
deleteCookie,
deleteAllCookies,
performActions,
releaseActions,
dismissAlert,
acceptAlert,
getAlertText,
sendAlertText,
takeScreenshot,
printPage,
getWindowHandles,
getWindowRect,
setWindowRect,
maximizeWindow,
minimizeWindow,
fullScreenWindow,
switchToParentFrame,
getActiveElement,
findElement,
findElements,
findElementFromElement,
findElementsFromElement,
isElementSelected,
getElementAttribute,
getElementProperty,
getElementCssValue,
getElementShadowRoot,
getElementText,
getElementTagName,
getElementRect,
isElementEnabled,
getElementComputedRole,
getElementComputedLabel,
elementClick,
elementClear,
elementSendKeys,
takeElementScreenshot,
findElementFromShadowRoot,
findElementsFromShadowRoot,
)
where
import Data.Aeson as A
( KeyValue ((.=)),
Value (..),
)
import Data.Text (Text)
import WebDriverPreCore.HTTP.Protocol
( Actions (..),
Cookie (..),
Status (..),
ElementId (..),
FrameReference (..),
FullCapabilities,
Script,
Selector (..),
Session (..),
SessionResponse (..),
Timeouts,
URL,
Handle (..),
WindowHandleSpec (..),
WindowRect (..),
ShadowRootElementId(..),
Command(..),
mkPost,
mkPost'
)
import Utils (UrlPath (..))
import Prelude hiding (id, lookup)
import Data.Aeson.KeyMap (fromList)
newSession :: FullCapabilities -> Command SessionResponse
newSession :: FullCapabilities -> Command SessionResponse
newSession = Text -> UrlPath -> FullCapabilities -> Command SessionResponse
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"New Session" UrlPath
newSessionUrl
status :: Command Status
status :: Command Status
status = Text -> UrlPath -> Command Status
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Status" (UrlPath -> Command Status) -> UrlPath -> Command Status
forall a b. (a -> b) -> a -> b
$ [Text] -> UrlPath
MkUrlPath [Text
"status"]
deleteSession :: Session -> Command ()
deleteSession :: Session -> Command ()
deleteSession Session
sessionRef = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
Delete Text
"Delete Session" (UrlPath -> Command ()) -> UrlPath -> Command ()
forall a b. (a -> b) -> a -> b
$ Text -> UrlPath
sessionUri Session
sessionRef.id
getTimeouts :: Session -> Command Timeouts
getTimeouts :: Session -> Command Timeouts
getTimeouts Session
sessionRef = Text -> UrlPath -> Command Timeouts
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Timeouts" (UrlPath -> Command Timeouts) -> UrlPath -> Command Timeouts
forall a b. (a -> b) -> a -> b
$ Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"timeouts"
setTimeouts :: Session -> Timeouts -> Command ()
setTimeouts :: Session -> Timeouts -> Command ()
setTimeouts Session
sessionRef =
Text -> UrlPath -> Timeouts -> Command ()
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Set Timeouts" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"timeouts")
navigateTo :: Session -> URL -> Command ()
navigateTo :: Session -> URL -> Command ()
navigateTo Session
sessionRef = Text -> UrlPath -> (URL -> Object) -> URL -> Command ()
forall {k} a (r :: k).
Text -> UrlPath -> (a -> Object) -> a -> Command r
mkPost' Text
"Navigate To" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"url") (\URL
url -> [(Key, Value)] -> Object
forall v. [(Key, v)] -> KeyMap v
fromList [Key
"url" Key -> URL -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= URL
url])
getCurrentUrl :: Session -> Command URL
getCurrentUrl :: Session -> Command URL
getCurrentUrl Session
sessionRef = Text -> UrlPath -> Command URL
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Current URL" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"url")
back :: Session -> Command ()
back :: Session -> Command ()
back Session
sessionRef = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Back" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"back")
forward :: Session -> Command ()
forward :: Session -> Command ()
forward Session
sessionRef = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Forward" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"forward")
refresh :: Session -> Command ()
refresh :: Session -> Command ()
refresh Session
sessionRef = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Refresh" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"refresh")
getTitle :: Session -> Command Text
getTitle :: Session -> Command Text
getTitle Session
sessionRef = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Title" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"title")
getWindowHandle :: Session -> Command Handle
getWindowHandle :: Session -> Command Handle
getWindowHandle Session
sessionRef = Text -> UrlPath -> Command Handle
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Window Handle" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"window")
newWindow :: Session -> Command WindowHandleSpec
newWindow :: Session -> Command WindowHandleSpec
newWindow Session
sessionRef = Text -> UrlPath -> Command WindowHandleSpec
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"New Window" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionRef Text
"window" Text
"new")
closeWindow :: Session -> Command [Handle]
closeWindow :: Session -> Command [Handle]
closeWindow Session
sessionRef = Text -> UrlPath -> Command [Handle]
forall {k} (r :: k). Text -> UrlPath -> Command r
Delete Text
"Close Window" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"window")
switchToWindow :: Session -> Handle -> Command ()
switchToWindow :: Session -> Handle -> Command ()
switchToWindow Session
sessionRef = Text -> UrlPath -> Handle -> Command ()
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Switch To Window" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"window")
switchToFrame :: Session -> FrameReference -> Command ()
switchToFrame :: Session -> FrameReference -> Command ()
switchToFrame Session
sessionRef = Text -> UrlPath -> FrameReference -> Command ()
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Switch To Frame" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"frame")
getPageSource :: Session -> Command Text
getPageSource :: Session -> Command Text
getPageSource Session
sessionId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Page Source" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"source")
executeScript :: Session -> Script -> Command Value
executeScript :: Session -> Script -> Command Value
executeScript Session
sessionId = Text -> UrlPath -> Script -> Command Value
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Execute Script" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"execute" Text
"sync")
executeScriptAsync :: Session -> Script -> Command Value
executeScriptAsync :: Session -> Script -> Command Value
executeScriptAsync Session
sessionId = Text -> UrlPath -> Script -> Command Value
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Execute Async Script" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"execute" Text
"async")
getAllCookies :: Session -> Command [Cookie]
getAllCookies :: Session -> Command [Cookie]
getAllCookies Session
sessionId = Text -> UrlPath -> Command [Cookie]
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get All Cookies" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"cookie")
getNamedCookie :: Session -> Text -> Command Cookie
getNamedCookie :: Session -> Text -> Command Cookie
getNamedCookie Session
sessionId Text
cookieName = Text -> UrlPath -> Command Cookie
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Named Cookie" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"cookie" Text
cookieName)
addCookie :: Session -> Cookie -> Command ()
addCookie :: Session -> Cookie -> Command ()
addCookie Session
sessionId Cookie
cookie = Text -> UrlPath -> Object -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Object -> Command r
Post Text
"Add Cookie" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"cookie") ([(Key, Value)] -> Object
forall v. [(Key, v)] -> KeyMap v
fromList [Key
"cookie" Key -> Cookie -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Cookie
cookie] )
deleteCookie :: Session -> Text -> Command ()
deleteCookie :: Session -> Text -> Command ()
deleteCookie Session
sessionId Text
cookieName = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
Delete Text
"Delete Cookie" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"cookie" Text
cookieName)
deleteAllCookies :: Session -> Command ()
deleteAllCookies :: Session -> Command ()
deleteAllCookies Session
sessionId = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
Delete Text
"Delete All Cookies" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"cookie")
performActions :: Session -> Actions -> Command ()
performActions :: Session -> Actions -> Command ()
performActions Session
sessionId = Text -> UrlPath -> Actions -> Command ()
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Perform Actions" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"actions")
releaseActions :: Session -> Command ()
releaseActions :: Session -> Command ()
releaseActions Session
sessionId = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
Delete Text
"Release Actions" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"actions")
dismissAlert :: Session -> Command ()
dismissAlert :: Session -> Command ()
dismissAlert Session
sessionId = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Dismiss Alert" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"alert" Text
"dismiss")
acceptAlert :: Session -> Command ()
acceptAlert :: Session -> Command ()
acceptAlert Session
sessionId = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Accept Alert" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"alert" Text
"accept")
getAlertText :: Session -> Command Text
getAlertText :: Session -> Command Text
getAlertText Session
sessionId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Alert Text" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"alert" Text
"text")
sendAlertText :: Session -> Text -> Command ()
sendAlertText :: Session -> Text -> Command ()
sendAlertText Session
sessionId Text
text = Text -> UrlPath -> Object -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Object -> Command r
Post Text
"Send Alert Text" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"alert" Text
"text") ([(Key, Value)] -> Object
forall v. [(Key, v)] -> KeyMap v
fromList [Key
"text" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
text])
takeScreenshot :: Session -> Command Text
takeScreenshot :: Session -> Command Text
takeScreenshot Session
sessionId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Take Screenshot" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"screenshot")
printPage :: Session -> Command Text
printPage :: Session -> Command Text
printPage Session
sessionId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Print Page" (Session -> Text -> UrlPath
sessionUri1 Session
sessionId Text
"print")
getWindowHandles :: Session -> Command [Handle]
getWindowHandles :: Session -> Command [Handle]
getWindowHandles Session
sessionRef = Text -> UrlPath -> Command [Handle]
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Window Handles" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionRef Text
"window" Text
"handles")
getWindowRect :: Session -> Command WindowRect
getWindowRect :: Session -> Command WindowRect
getWindowRect Session
sessionRef = Text -> UrlPath -> Command WindowRect
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Window Rect" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionRef Text
"window" Text
"rect")
setWindowRect :: Session -> WindowRect -> Command WindowRect
setWindowRect :: Session -> WindowRect -> Command WindowRect
setWindowRect Session
sessionRef = Text -> UrlPath -> WindowRect -> Command WindowRect
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Set Window Rect" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionRef Text
"window" Text
"rect")
maximizeWindow :: Session -> Command WindowRect
maximizeWindow :: Session -> Command WindowRect
maximizeWindow Session
sessionRef = Text -> UrlPath -> Command WindowRect
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Maximize Window" (Session -> Text -> UrlPath
windowUri1 Session
sessionRef Text
"maximize")
minimizeWindow :: Session -> Command WindowRect
minimizeWindow :: Session -> Command WindowRect
minimizeWindow Session
sessionRef = Text -> UrlPath -> Command WindowRect
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Minimize Window" (Session -> Text -> UrlPath
windowUri1 Session
sessionRef Text
"minimize")
fullScreenWindow :: Session -> Command WindowRect
fullScreenWindow :: Session -> Command WindowRect
fullScreenWindow Session
sessionRef = Text -> UrlPath -> Command WindowRect
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Fullscreen Window" (Session -> Text -> UrlPath
windowUri1 Session
sessionRef Text
"fullscreen")
switchToParentFrame :: Session -> Command ()
switchToParentFrame :: Session -> Command ()
switchToParentFrame Session
sessionRef = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Switch To Parent Frame" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionRef Text
"frame" Text
"parent")
getActiveElement :: Session -> Command ElementId
getActiveElement :: Session -> Command ElementId
getActiveElement Session
sessionId = Text -> UrlPath -> Command ElementId
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Active Element" (Session -> Text -> Text -> UrlPath
sessionUri2 Session
sessionId Text
"element" Text
"active")
findElement :: Session -> Selector -> Command ElementId
findElement :: Session -> Selector -> Command ElementId
findElement Session
sessionRef = Text -> UrlPath -> Selector -> Command ElementId
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Find Element" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"element")
findElements :: Session -> Selector -> Command [ElementId]
findElements :: Session -> Selector -> Command [ElementId]
findElements Session
sessionRef = Text -> UrlPath -> Selector -> Command [ElementId]
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Find Elements" (Session -> Text -> UrlPath
sessionUri1 Session
sessionRef Text
"elements")
getElementShadowRoot :: Session -> ElementId -> Command ShadowRootElementId
getElementShadowRoot :: Session -> ElementId -> Command ShadowRootElementId
getElementShadowRoot Session
sessionId ElementId
elementId = Text -> UrlPath -> Command ShadowRootElementId
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element Shadow Root" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"shadow")
findElementFromElement :: Session -> ElementId -> Selector -> Command ElementId
findElementFromElement :: Session -> ElementId -> Selector -> Command ElementId
findElementFromElement Session
sessionId ElementId
elementId = Text -> UrlPath -> Selector -> Command ElementId
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Find Element From Element" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"element")
findElementsFromElement :: Session -> ElementId -> Selector -> Command [ElementId]
findElementsFromElement :: Session -> ElementId -> Selector -> Command [ElementId]
findElementsFromElement Session
sessionId ElementId
elementId = Text -> UrlPath -> Selector -> Command [ElementId]
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Find Elements From Element" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"elements")
isElementSelected :: Session -> ElementId -> Command Bool
isElementSelected :: Session -> ElementId -> Command Bool
isElementSelected Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Bool
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Is Element Selected" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"selected")
getElementAttribute :: Session -> ElementId -> Text -> Command Text
getElementAttribute :: Session -> ElementId -> Text -> Command Text
getElementAttribute Session
sessionId ElementId
elementId Text
attributeName = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element Attribute" (Session -> ElementId -> Text -> Text -> UrlPath
elementUri2 Session
sessionId ElementId
elementId Text
"attribute" Text
attributeName)
getElementProperty :: Session -> ElementId -> Text -> Command Value
getElementProperty :: Session -> ElementId -> Text -> Command Value
getElementProperty Session
sessionId ElementId
elementId Text
propertyName = Text -> UrlPath -> Command Value
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element Property" (Session -> ElementId -> Text -> Text -> UrlPath
elementUri2 Session
sessionId ElementId
elementId Text
"property" Text
propertyName)
getElementCssValue :: Session -> ElementId -> Text -> Command Text
getElementCssValue :: Session -> ElementId -> Text -> Command Text
getElementCssValue Session
sessionId ElementId
elementId Text
propertyName = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element CSS Value" (Session -> ElementId -> Text -> Text -> UrlPath
elementUri2 Session
sessionId ElementId
elementId Text
"css" Text
propertyName)
getElementText :: Session -> ElementId -> Command Text
getElementText :: Session -> ElementId -> Command Text
getElementText Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element Text" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"text")
getElementTagName :: Session -> ElementId -> Command Text
getElementTagName :: Session -> ElementId -> Command Text
getElementTagName Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element Tag Name" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"name")
getElementRect :: Session -> ElementId -> Command WindowRect
getElementRect :: Session -> ElementId -> Command WindowRect
getElementRect Session
sessionId ElementId
elementId = Text -> UrlPath -> Command WindowRect
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Element Rect" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"rect")
isElementEnabled :: Session -> ElementId -> Command Bool
isElementEnabled :: Session -> ElementId -> Command Bool
isElementEnabled Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Bool
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Is Element Enabled" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"enabled")
getElementComputedRole :: Session -> ElementId -> Command Text
getElementComputedRole :: Session -> ElementId -> Command Text
getElementComputedRole Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Computed Role" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"computedrole")
getElementComputedLabel :: Session -> ElementId -> Command Text
getElementComputedLabel :: Session -> ElementId -> Command Text
getElementComputedLabel Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Get Computed Label" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"computedlabel")
elementClick :: Session -> ElementId -> Command ()
elementClick :: Session -> ElementId -> Command ()
elementClick Session
sessionId ElementId
elementId = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Element Click" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"click")
elementClear :: Session -> ElementId -> Command ()
elementClear :: Session -> ElementId -> Command ()
elementClear Session
sessionId ElementId
elementId = Text -> UrlPath -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Command r
PostEmpty Text
"Element Clear" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"clear")
elementSendKeys :: Session -> ElementId -> Text -> Command ()
elementSendKeys :: Session -> ElementId -> Text -> Command ()
elementSendKeys Session
sessionId ElementId
elementId Text
keysToSend = Text -> UrlPath -> Object -> Command ()
forall {k} (r :: k). Text -> UrlPath -> Object -> Command r
Post Text
"Element Send Keys" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"value") ([(Key, Value)] -> Object
forall v. [(Key, v)] -> KeyMap v
fromList [Key
"text" Key -> Text -> (Key, Value)
forall v. ToJSON v => Key -> v -> (Key, Value)
forall e kv v. (KeyValue e kv, ToJSON v) => Key -> v -> kv
.= Text
keysToSend])
takeElementScreenshot :: Session -> ElementId -> Command Text
takeElementScreenshot :: Session -> ElementId -> Command Text
takeElementScreenshot Session
sessionId ElementId
elementId = Text -> UrlPath -> Command Text
forall {k} (r :: k). Text -> UrlPath -> Command r
Get Text
"Take Element Screenshot" (Session -> ElementId -> Text -> UrlPath
elementUri1 Session
sessionId ElementId
elementId Text
"screenshot")
findElementFromShadowRoot :: Session -> ShadowRootElementId -> Selector -> Command ElementId
findElementFromShadowRoot :: Session -> ShadowRootElementId -> Selector -> Command ElementId
findElementFromShadowRoot Session
sessionId ShadowRootElementId
shadowId = Text -> UrlPath -> Selector -> Command ElementId
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Find Element From Shadow Root" (Session -> Text -> Text -> Text -> UrlPath
sessionUri3 Session
sessionId Text
"shadow" ShadowRootElementId
shadowId.id Text
"element")
findElementsFromShadowRoot :: Session -> ShadowRootElementId -> Selector -> Command [ElementId]
findElementsFromShadowRoot :: Session -> ShadowRootElementId -> Selector -> Command [ElementId]
findElementsFromShadowRoot Session
sessionId ShadowRootElementId
shadowId = Text -> UrlPath -> Selector -> Command [ElementId]
forall {k} a (r :: k).
ToJSON a =>
Text -> UrlPath -> a -> Command r
mkPost Text
"Find Elements From Shadow Root" (Session -> Text -> Text -> Text -> UrlPath
sessionUri3 Session
sessionId Text
"shadow" ShadowRootElementId
shadowId.id Text
"elements")
newSessionUrl :: UrlPath
newSessionUrl :: UrlPath
newSessionUrl = [Text] -> UrlPath
MkUrlPath [Text
session]
session :: Text
session :: Text
session = Text
"session"
sessionUri :: Text -> UrlPath
sessionUri :: Text -> UrlPath
sessionUri Text
sp = [Text] -> UrlPath
MkUrlPath [Text
session, Text
sp]
sessionUri1 :: Session -> Text -> UrlPath
sessionUri1 :: Session -> Text -> UrlPath
sessionUri1 Session
s Text
sp = [Text] -> UrlPath
MkUrlPath [Text
session, Session
s.id, Text
sp]
sessionUri2 :: Session -> Text -> Text -> UrlPath
sessionUri2 :: Session -> Text -> Text -> UrlPath
sessionUri2 Session
s Text
sp Text
sp2 = [Text] -> UrlPath
MkUrlPath [Text
session, Session
s.id, Text
sp, Text
sp2]
sessionUri3 :: Session -> Text -> Text -> Text -> UrlPath
sessionUri3 :: Session -> Text -> Text -> Text -> UrlPath
sessionUri3 Session
s Text
sp Text
sp2 Text
sp3 = [Text] -> UrlPath
MkUrlPath [Text
session, Session
s.id, Text
sp, Text
sp2, Text
sp3]
sessionUri4 :: Session -> Text -> Text -> Text -> Text -> UrlPath
sessionUri4 :: Session -> Text -> Text -> Text -> Text -> UrlPath
sessionUri4 Session
s Text
sp Text
sp2 Text
sp3 Text
sp4 = [Text] -> UrlPath
MkUrlPath [Text
session, Session
s.id, Text
sp, Text
sp2, Text
sp3, Text
sp4]
elementUri1 :: Session -> ElementId -> Text -> UrlPath
elementUri1 :: Session -> ElementId -> Text -> UrlPath
elementUri1 Session
s ElementId
er Text
ep = Session -> Text -> Text -> Text -> UrlPath
sessionUri3 Session
s Text
"element" ElementId
er.id Text
ep
elementUri2 :: Session -> ElementId -> Text -> Text -> UrlPath
elementUri2 :: Session -> ElementId -> Text -> Text -> UrlPath
elementUri2 Session
s ElementId
er Text
ep Text
ep2 = Session -> Text -> Text -> Text -> Text -> UrlPath
sessionUri4 Session
s Text
"element" ElementId
er.id Text
ep Text
ep2
window :: Text
window :: Text
window = Text
"window"
windowUri1 :: Session -> Text -> UrlPath
windowUri1 :: Session -> Text -> UrlPath
windowUri1 Session
sr Text
sp = Session -> Text -> Text -> UrlPath
sessionUri2 Session
sr Text
window Text
sp