ApplesauceOS
Read Markdown ↗Download .md

Element.waitFor

Wait for a custom read-only condition. Scoped to descendants.

js
element.waitFor(condition, optionsOrTimeout?)

Arguments

ArgumentTypeMeaning
conditionfunctionSynchronous callback receiving this query client. Return a truthy value when ready; do not return a Promise or perform actions.
optionsOrTimeoutobject | numberOptional milliseconds, or {timeout:5000, interval:100, throwOnTimeout:true}. Interval is at least 10 ms.

Returns

First truthy callback result. Timeout throws, or returns null when disabled.

Example

js
const panel = UIHelper.waitForElement({id: "panel"}, 5000);
const child = panel.waitFor(q => q.findElement({id: "ready", visible: true}), 5000);

Notes

The parent must still be valid. See the matching UIHelper method for options. Placeholder panel/child identifiers require inspection.

All JavaScript APIs · Automation playbook