Click On

Click with the mouse on the specified element.
Use this for clicking buttons and links.

If you like to tick a checkbox, select a radio button or choose an item from a list, use the Select command instead.

Parameters

wpath
The WPath identifying the control to click on (see WPath for a detailed description).
It is possible to use the '*' and the '?' character als wildcards; '*' matches zero or many characters; '?' matches one single character.
It is also possible to define a > separated list of words (with '*' and '?' if needed). Then this command clicks on the first clickable element after all these words.

Examples

Click a button

Click on a button labled 'Search'.

Command Parameter Optional Parameter
click-on Search

Click an anchor

Click on an anchor labled 'Show details'.

Command Parameter Optional Parameter
click-on Show details

Click a graphic button

{{% image src="docu-cmd-click-imgbutton.png" %}}

Because Wetator is not able to understand graphics you have to use the usual hints for clicking this kind of buttons. Typically this kind of buttons have a tooltip (title attribute) that can be used. Another alternative is the use of the alt attribute defined for the image.

Command Parameter Optional Parameter
click-on Add to cart

Click by aria-label

Some applications are styling buttons/anchors by assigning a picture using css. For these kind of buttons/anchors there is the aria-label attribute to assign an invisible label to the button (see W3C Spec). Wetator is able to identify these buttons/anchors based on the aria-label attribute value.

Button:

<button type="button" aria-label='Do Search' onClick="this.form.submit();">
    <span style="background: url(search.png); height: 44px; width: 44px; display: block;""></span">
</button">

Command Parameter Optional Parameter
click-on Do Search

Anchor:

<a aria-label="Close" href="#" role="button">
    <span style="background: url(x.png); height: 10px; width: 10px; display: block;""></span">
</a>

Command Parameter Optional Parameter
click-on Close