test_context_menu
Verifies extension context menus by checking the contextMenus API, simulating right-clicks on page elements, and triggering menu item handlers to validate behavior.
Instructions
Test context menus registered by the extension. Can verify the contextMenus API is available and simulate right-click events on page elements.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "test_context_menu"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | No | URL to navigate to before right-clicking (optional) | |
| action | Yes | check_api: verify contextMenus API is available in service worker; right_click: simulate right-click on a selector (triggers contextmenu DOM event); trigger_item: invoke a context menu item handler by id via service worker | |
| page_url | No | The pageUrl to pass to the onClicked handler (for 'trigger_item' action) | |
| selector | No | CSS selector of the element to right-click (for 'right_click' action) | |
| menu_item_id | No | The context menu item ID to trigger (for 'trigger_item' action — matches the id passed to chrome.contextMenus.create) |