module Test.WebDriver.Commands.ElementState (
isSelected
, attr
, prop
, cssProp
, getText
, tagName
, elemRect
, isEnabled
) where
import Data.Aeson as A
import Data.Text (Text, append)
import GHC.Stack
import Test.WebDriver.Commands.CommandContexts
import Test.WebDriver.Types
import Test.WebDriver.Util.Commands
isSelected :: (HasCallStack, WebDriver wd) => Element -> wd Bool
isSelected :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> wd Bool
isSelected Element
e = Method -> Element -> Text -> Value -> wd Bool
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e Text
"/selected" Value
Null
attr :: (HasCallStack, WebDriver wd) => Element -> Text -> wd (Maybe Text)
attr :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> Text -> wd (Maybe Text)
attr Element
e Text
t = Method -> Element -> Text -> Value -> wd (Maybe Text)
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e (Text
"/attribute/" Text -> Text -> Text
`append` Text -> Text
urlEncode Text
t) Value
Null
prop :: (HasCallStack, WebDriver wd) => Element -> Text -> wd (Maybe Value)
prop :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> Text -> wd (Maybe Value)
prop Element
e Text
t = Method -> Element -> Text -> Value -> wd (Maybe Value)
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e (Text
"/property/" Text -> Text -> Text
`append` Text -> Text
urlEncode Text
t) Value
Null
cssProp :: (HasCallStack, WebDriver wd) => Element -> Text -> wd (Maybe Text)
cssProp :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> Text -> wd (Maybe Text)
cssProp Element
e Text
t = Method -> Element -> Text -> Value -> wd (Maybe Text)
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e (Text
"/css/" Text -> Text -> Text
`append` Text -> Text
urlEncode Text
t) Value
Null
getText :: (HasCallStack, WebDriver wd) => Element -> wd Text
getText :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> wd Text
getText Element
e = Method -> Element -> Text -> Value -> wd Text
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e Text
"/text" Value
Null
tagName :: (HasCallStack, WebDriver wd) => Element -> wd Text
tagName :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> wd Text
tagName Element
e = Method -> Element -> Text -> Value -> wd Text
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e Text
"/name" Value
Null
elemRect :: (HasCallStack, WebDriver wd) => Element -> wd Rect
elemRect :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> wd Rect
elemRect Element
e = Method -> Element -> Text -> Value -> wd Rect
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e Text
"/rect" Value
Null
isEnabled :: (HasCallStack, WebDriver wd) => Element -> wd Bool
isEnabled :: forall (wd :: * -> *).
(HasCallStack, WebDriver wd) =>
Element -> wd Bool
isEnabled Element
e = Method -> Element -> Text -> Value -> wd Bool
forall (wd :: * -> *) a b.
(HasCallStack, WebDriver wd, ToJSON a, FromJSON b) =>
Method -> Element -> Text -> a -> wd b
doElemCommand Method
methodGet Element
e Text
"/enabled" Value
Null