Appearance
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
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selector | string | CSS or XPath selector to wait for. |
options? | WaitForSelectorOptions | Wait 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.