Safe Haskell | None |
---|
This module exposes webdriver actions that can be used to interact with a page which uses AngularJs. This provides similar functionality as protractor and in fact we share some code with protractor.
- waitForAngular :: WebDriver wd => Text -> wd Bool
- data NgException = NgException String
- data NgSelector
- findNg :: (MonadIO wd, WebDriver wd) => NgSelector -> wd Element
- findNgs :: WebDriver wd => NgSelector -> wd [Element]
- findNgFrom :: (MonadIO wd, WebDriver wd) => Element -> NgSelector -> wd Element
- findNgsFrom :: WebDriver wd => Element -> NgSelector -> wd [Element]
- data NgRepeater
- findRepeater :: (MonadIO wd, WebDriver wd) => NgRepeater -> wd Element
- findRepeaters :: WebDriver wd => NgRepeater -> wd [Element]
- findRepeaterFrom :: (MonadIO wd, WebDriver wd) => Element -> NgRepeater -> wd Element
- findRepeatersFrom :: WebDriver wd => Element -> NgRepeater -> wd [Element]
- ngEvaluate :: (WebDriver wd, FromJSON a) => Element -> Text -> wd a
- getLocationAbsUrl :: WebDriver wd => Text -> wd Text
Loading
Wait until Angular has finished rendering before continuing. False
indicates the timeout
was hit (see setScriptTimeout
) and we stopped waiting and True
means that angular has
finished rendering.
Searching for elements
data NgException Source
Exceptions of this type will be thrown when an element is unable to be located.
data NgSelector Source
ByBinding Text | Argument is the binding, e.g. {{dog.name}} |
ByModel Text | Argument is the model name. This is just a combination of |
ByInput Text | Input element with matching model name, e.g. |
ByTextarea Text | Textarea element with matching model name, e.g. |
BySelect Text | Select element with matching model name, e.g. |
BySelectedOption Text | Selected options with a select element matching the modelname. That is,
The |
findNg :: (MonadIO wd, WebDriver wd) => NgSelector -> wd ElementSource
Find a single element from the document matching the given Angular selector. If zero or more
than one element is returned, an exception of type NgException
is thrown.
findNgs :: WebDriver wd => NgSelector -> wd [Element]Source
Find elements from the document matching the given Angular selector.
findNgFrom :: (MonadIO wd, WebDriver wd) => Element -> NgSelector -> wd ElementSource
Find a single element from within the given element which matches the given Angular selector. If
zero or more than one element is returned, an exception of type NgException
is thrown.
findNgsFrom :: WebDriver wd => Element -> NgSelector -> wd [Element]Source
Find elements from within the given element which match the given Angular selector.
data NgRepeater Source
ByRows Text | All the rows matching the repeater (e.g. 'dog in dogs') |
ByRow Text Int | A single row specified by the text of the repeater (e.g. 'dog in dogs') and the row index |
ByColumn Text Text | A single column matching the text of the repeater (e.g. 'dog in dogs') and the column binding (e.g '{{dog.name}}'). |
ByRowAndCol Text Int Text | A single row and column, given (repeater, row index, column binding). |
findRepeater :: (MonadIO wd, WebDriver wd) => NgRepeater -> wd ElementSource
Find an element from the document which matches the Angular repeater. If zero or more than one
element are returned, an exception of type NgException
is thrown.
findRepeaters :: WebDriver wd => NgRepeater -> wd [Element]Source
Find elements from the document which match the Angular repeater.
findRepeaterFrom :: (MonadIO wd, WebDriver wd) => Element -> NgRepeater -> wd ElementSource
Find an element from the given element which matches the Angular repeater. If zero or more than
one are returned, an exception of type NgException
is thrown.
findRepeatersFrom :: WebDriver wd => Element -> NgRepeater -> wd [Element]Source
Find elements from the given element which match the Angular repeater.
Misc
:: (WebDriver wd, FromJSON a) | |
=> Element | element in whose scope to evaluate |
-> Text | expression to evaluate, e.g. "dog.name | reverse" |
-> wd a |
Evaluate an angular expression, using the scope attached to the given element.
Return the current absolute url according to Angular (using $location.absUrl()
).