Skip to main content

sdk.watcher.waitforselector

Home > @matterway/sdk > Watcher > waitForSelector

Watcher.waitForSelector() function

Waits for a selector to become visible.

Signature:

export declare function waitForSelector(ctx: Context, selector: string, options?: WaitForSelectorOptions): Promise<ElementHandle<Element> | null>;

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringthe selector to wait for.
optionsWaitForSelectorOptions(Optional) Wait for selector options.

Returns:

Promise<ElementHandle<Element> | null>

Example

async function step(ctx: Context) {
const $el = await waitForSelector(ctx, selector);
}