# UIHelper.findElementsInRect

Find elements whose snapshot centers lie in a rectangle.

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

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `rectangle` | object | {x,y,width,height} in native pixels; positive width and height. |
| `selector` | object \| string | Optional; defaults to {visible:true}. |
| `options` | object | Optional {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](https://mcp.applesauceos.com/doc/api.md) · [Automation playbook](https://mcp.applesauceos.com/doc/ai.md)
