webdriver-angular-0.1.8: Webdriver actions to assist with testing a webpage which uses Angular.Js

Safe HaskellNone
LanguageHaskell98

Test.WebDriver.Commands.Angular

Contents

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.

Synopsis

Loading

waitForAngular Source #

Arguments

:: (MonadIO wd, WebDriver wd) 
=> Text

CSS selector to element which has ng-app

-> wd Bool 

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 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 ng-model="name" attribute.

BySelectedOption Text

Argument is a model name. Searches for selected options within a select element matching the modelname. That is, the <option:checked> elements within a <select ng-model="name" ... >.

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).

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

ngEvaluate Source #

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.

getLocationAbsUrl Source #

Arguments

:: WebDriver wd 
=> Text

CSS selector to element which has ng-app

-> wd Text 

Return the current absolute url according to Angular (using $location.absUrl()).

setNgLocation Source #

Arguments

:: (MonadIO wd, WebDriver wd) 
=> Text

CSS selector to the element which has ng-app

-> Text

URL

-> wd () 

Browse to another page using in-page navigation (via $location.url).