ApplesauceOS
Read Markdown ↗Download .md

UIHelper.findElementsInRect

Find elements whose snapshot centers lie in a rectangle.

js
ui.findElementsInRect(rectangle, selector?, options?)

Arguments

ArgumentTypeMeaning
rectangleobject{x,y,width,height} in native pixels; positive width and height.
selectorobject | stringOptional; defaults to {visible:true}.
optionsobjectOptional {timeout:0, interval:100}. Ordinary queries do not wait by default.

Returns

Element array.

Example

js
const items = UIHelper.findElementsInRect({x: 0, y: 0, width: 300, height: 400}, {type: "Button"});
console.log(items.length);

Notes

Rectangle edges are inclusive. Adjust the example region to the current screenshot.

All JavaScript APIs · Automation playbook