How do I click at specific coordinates
This example demonstrates how to perform click action on links, buttons, check-boxes or radio buttons based on the coordinates. Coordinates specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
In the solution shown below, you will see that we are clicking on "Calculate" button in HICC application using "clickAt" command by providing the coordinate values in the "Value" field.
Solution:
# | Command | Target | Value |
---|---|---|---|
Clicking on the "Calculate" button | |||
1 | clickAt | xpath=(//div[@id='btn_calculateControls']/a)[1] | 0,0 |
Tips, Tricks, Gotchas & Best Practices:
- In the cases where the click action would take time, you can use clickAtAndWait command to perform click action based on the coordinates.
- 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.