Appearance
Function: clickByText()
ts
function clickByText(
ctx: Context,
text: string,
filterOptions?: FilterOptions): Promise<void>;Defined in: src/mouse/index.ts:99
Click an element by its visible text.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
text | string | Text content to match. |
filterOptions? | FilterOptions | Options to narrow the XPath selector. |
Returns
Promise<void>
Example
ts
// Click the "Add to Cart" button on a product page
await clickByText(ctx, 'Add to Cart');