selector.test.selected

getSelector(id).test.selected()

or getSelector(id).test.selected( element )

Tests whether an element is selected.

When testing an element, remember to use a get* command, as simply typing its ID will fail (ie. test for getImage("square"), not just "square")

Example:

[js highlight=”12″ try=”true”]
newImage(“square”, “square.png”)
,
newImage(“triangle”, “triangle.png”)
.settings.before( getImage(“square”) )
.print()
,
newSelector(“shapes”)
.settings.add( getImage(“square”) , getImage(“triangle”) )
,
newButton(“validation”, “Validate”)
.print()
.wait( getSelector(“shapes”).test.selected() )
[/js]

Adds two images side by side, and a Validate button below them. The button will validate a click only after an image has been selected.