Skip to main content

sdk.watcher.waitfortext

Home > @matterway/sdk > Watcher > waitForText

Watcher.waitForText() function

Waits for text to appear in element.

Signature:

export declare function waitForText(ctx: Context, label: string, element?: string, options?: WaitForSelectorOptions): Promise<import("puppeteer-core").ElementHandle<Node> | null>;

Parameters

ParameterTypeDescription
ctxContextContext object.
labelstringText to wait for.
elementstring(Optional) Element in which to wait for text.
optionsWaitForSelectorOptions(Optional) Wait options.

Returns:

Promise<import("puppeteer-core").ElementHandle<Node> | null>

Example 1

const xlabel = waitForText(ctx, '*', element);

Example 2

const xlabel = waitForText(ctx, '*', element, {hidden:true, timeout:200});