Link Search Menu Expand Document

selector.test.selected

description

Tests whether an element is selected.

syntax

getSelector(ELEMENT_NAME).test.selected()

alternate(s)

  • getSelector(ELEMENT_NAME).test.selected( element )

notes

  • 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(s)


@
@newImage("square", "square.png")
@,
@newImage("triangle", "triangle.png")
@    .before( getImage("square") )
@    .print()
@,
@newSelector("shapes")
@    .add( getImage("square") , getImage("triangle") )
@,
@newButton("validation", "Validate")
@    .print()
$    .wait( getSelector("shapes").test.selected() )
  • 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.