| Safe Haskell | None |
|---|---|
| Language | Haskell98 |
Test.WebDriver.Commands.Angular
Description
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 :: (MonadIO wd, 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
- findRepeaters :: WebDriver wd => NgRepeater -> wd [Element]
- findRepeater :: (MonadIO wd, 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
- setNgLocation :: (MonadIO wd, WebDriver wd) => Text -> Text -> wd ()
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.
Constructors
| NgException String |
Instances
data NgSelector Source #
Constructors
| ByBinding Text | Argument is the binding, e.g. {{dog.name}} |
| ByModel Text | Argument is the model name. Searches for elements with the |
| BySelectedOption Text | Argument is a model name. Searches for selected options within a select element
matching the modelname. That is, the |
Instances
findNg :: (MonadIO wd, WebDriver wd) => NgSelector -> wd Element Source #
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 Element Source #
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 #
Constructors
| 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). |
Instances
findRepeaters :: WebDriver wd => NgRepeater -> wd [Element] Source #
Finds elements from the document which match the NgRepeater.
Note that when using ng-repeat-start and ng-repeat-end and looking up using ByRows, all
elements are returned in one big list, not grouped by each instance of ng-repeat-start.
findRepeater :: (MonadIO wd, WebDriver wd) => NgRepeater -> wd Element Source #
A variant on findRepeaters which throws an exception if the return value from findRepeaters
does not have length exactly one.
findRepeaterFrom :: (MonadIO wd, WebDriver wd) => Element -> NgRepeater -> wd Element Source #
A variant of findRepater which allows searching only the given element.
findRepeatersFrom :: WebDriver wd => Element -> NgRepeater -> wd [Element] Source #
A variant of findRepaters which allows searching only the given element.
Misc
Arguments
| :: (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()).