Skip to content

How do I click on a link

This example demonstrates how to perform click action on links, buttons, check-boxes and radio buttons

In the solution shown below, you will see that click action is performed on "Calculate" button in HICC using "click" command.

Solution:

# Command Target Value
Clicking on the Calculate button
1 click xpath=(//div[@id='btn_calculateControls']/a)[1]

Tips, Tricks, Gotchas & Best Practices:  

  • As an alternative to "click" command, you can use the clickAt command to perform the click action.
  • In the cases where the click action would take time, you can use clickAndWait or clickAtAndWait commands.
  • If the above-mentioned commands fail to perform the click action then you can use the "click" command with the text "javascript" in the value.
  • In case to perform two click actions on the same element, you can use doubleClick command. It performs click action twice in a single go.
  • As a best practice, you are encouraged to validate visibility of any element that is expected to be displayed after the click action using assertVisible, verifyVisible or waitForVisible commands.