Click on element with offset
When automating desktop applications, clicks are often done not only in the center of the selected element but somewhere else (the corner, or the corner with offset). Click offset is a click on the given element with the relative position (x, y) from the top left corner of that element. Clicking on elements with offset facilitates automating complex controls like trees (Outlook) or tables with checkboxes (SAP).
API
def elem = $(By.cssSelector("[TOOLTIP:ToolTip demo]"));
elem.click(elem.right() + 30, elem.bottom() - 15);
elem.click(elem.left() + 10, elem.top() - 15);
elem.click(-10, 15);
Description
- Works for desktop automation only.
- It throws exception.
- Valid for any mouse click (double, triple, wheel).
- Point 0,0 is in the top left corner of the element.
Examples
The feature can be used in combination with window filtering by process ID.
Expand to see the example
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://web-harvest.sourceforge.net/schema/1.0/config" scriptlang="groovy">
<robotics-flow>
<robot driver="universal">
<script></script>
</robot>
</robotics-flow>
<export include-original-data="true"/>
</config>