Skip to content

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

ParameterTypeDescription
ctxContextContext object.
selectorstringCSS or XPath selector for the target element.
options?WaitForSelectorOptions & ClickOptionsOptional 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"]');

Matterway Assistant SDK Documentation