When the “click” command fails, the “Click” command is automatically changed to the “Click specified position” command and the step is executed. This page explains the difference between the “Click” and “Click specified position” commands and which command should be used. While this page mentions “Click” for browser testing, the same conditions apply to “Tap” and “Tap specified position” commands for mobile app testing.
Conditions when the “Click” command fails and becomes a “Click specified position” command
The change to the specified position click is made when another element overlaps the element to be clicked. In such a case, this is recorded in the test execution log as follows.
click([Register button], {})
[WARNING] As operation on the specified element failed, will retry by specifying coordinates. If the target element is covered by another element, the element above will be clicked.
the target position: (1099, 799)
For example, if a drop-down menu is open and overlays a button element, "Click" will fail and it will be changed to "Click at specified position."
Also, even if there are no overlapping elements on the screen, the test may fail if there are overlapping elements on the code.
<button>
<div>xxxx</div>
</button>
For example, in this case, if a div element is set as the click target, it may be judged that “a button element exists above the div element” and the click event may fail. In this case, if the click target is changed to the button element, the click will be successful.
Difference between “Click” and “Click specified position” commands
The “Click” command guarantees that a click event has occurred on the target element. On the other hand, “Click specified position” only means clicking at the coordinates of the target element, so it does not guarantee that a click event has occurred. It is recommended to minimize the use of the “Click specified position” command and to aim for a state in which the “Click” command can be used to click without problems.