Appearance
Function: triggerContextMenu()
ts
function triggerContextMenu(
ctx: Context,
selector: string,
options?: WaitForSelectorOptions & ClickOptions): Promise<void>;Defined in: src/mouse/index.ts:198
Trigger a context menu event on an element.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selector | string | CSS or XPath selector for the target element. |
options? | WaitForSelectorOptions & ClickOptions | Optional wait and success condition settings. |
Returns
Promise<void>
Example
ts
// Right-click a canvas element to open a custom context menu
await triggerContextMenu(ctx, 'canvas[id="drawing-board"]');