Skip to content

Variable: waitForXPath()

ts
const waitForXPath: (ctx: Context, selector: string, options?: WaitForSelectorOptions) => Promise<ElementHandle<Element> | null> = waitForSelector;

Defined in: src/wait/waiters/waitForSelector.ts:121

Wait for a selector to appear on the page.

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringCSS or XPath selector to wait for.
options?WaitForSelectorOptionsWait for selector options.

Returns

Promise<ElementHandle<Element> | null>

The matched element handle, or null for negative XPath conditions.

Example

ts
// Wait for the big red "Buy Now" button
await waitForSelector(ctx, '#buy-now-btn');

// XPath works too
await waitForSelector(ctx, '//button[text()="Add to Cart"]');

Deprecated

Use waitForSelector instead.

Wait for an XPath selector to appear on the page.

Matterway Assistant SDK Documentation