Skip to content

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

ParameterTypeDescription
ctxContextContext object.
textstringText content to match.
filterOptions?FilterOptionsOptions 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');

Matterway Assistant SDK Documentation