Right Click task | Zoho QEngine Help

Right Click task

In a nutshell

The Right Click task performs a right-click on a web element during test execution. It's used to trigger context-specific interactions, such as opening a row's actions menu in a results table.

1. Overview

The Right Click task is used to perform a right-click on a web element during test execution. It is intended for testing application-specific interactions that are available only through a right-click, such as custom context menus, quick action menus, or record-level actions.
Unlike the Click task, which performs a standard left-click, the Right Click task is used to trigger application-specific context menus and actions. Follow it with an appropriate assertion task, such as Assert Visible or Assert Text, to verify the expected result.

2. Syntax


rightClick(<locator>);


ParameterData TypeDescription
locatorSTRINGIdentifies the element to right-click.
NotesNote: Locators can be found by manually inspecting the webpage for the element, or by using an element already saved through a recording session. Learn more about Elements

3. Examples

Example 1: Opening a custom context menu on the search results heading

Search for a product, then right-click the results heading to open a custom share-results context menu.

// Open the ZWatch Commerce home page using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Click the search icon to reveal the search input using the Click task
click(".theme-search");
// Enter a search term using the Set Value task
setValue("[data-search-input]", "Chrono 44");
// Submit the search using the <Send Keys> task
sendKeys("[data-search-input]", [keys.ENTER]);
// Right-click the results heading using the Right Click task
rightClick(".search-results-heading");
// Confirm the share-results context menu appears using the Assert Visible task
assertVisible(ui.zwatch.share-results-menu, errorhandling.STOP_ON_ERROR);

where:


"https://zwatch.zohocommerce.com/"ZWatch Commerce home page URL.
"same window"Opens the page in the window already running the test.
.theme-searchLocator for the search icon.
[data-search-input]Locator for the search box.
"Chrono 44"Search term entered into the search box.
.search-results-headingLocator for the results heading
ui.zwatch.share-results-menuLocator for the share-results context menu.
errorhandling.STOP_ON_ERRORStops the test if the share-results context menu doesn't appear.

Example 2: Opening row actions in a search results table

Right-click a row in a data table to open its row-level actions menu.

// Open the ZWatch Commerce home page using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Click the search icon to reveal the search input using the Click task
click(".theme-search");
// Enter a search term using the Set Value task
setValue("[data-search-input]", "Chrono 44");
// Submit the search using the <Send Keys> task
sendKeys("[data-search-input]", [keys.ENTER]);
// Right-click the first search result row using the Right Click task
rightClick(ui.zwatch.search-result-row);
// Confirm the row actions menu appears using the Assert Visible task
assertVisible(ui.zwatch.row-actions-menu, errorhandling.STOP_ON_ERROR);
// Select Add to Compare from the actions menu using the Click task
click(ui.zwatch.row-actions-add-to-compare);
// Confirm that the comparison bar reflects the added item using the Assert Visible task
assertVisible(ui.zwatch.compare-bar, errorhandling.STOP_ON_ERROR);

where:


"https://zwatch.zohocommerce.com/"ZWatch Commerce home page URL.
"same window"Opens the page in the window already running the test.
.theme-searchLocator for the search icon.
[data-search-input]Locator for the search box.
"Chrono 44"Search term entered into the search box.
ui.zwatch.search-result-rowLocator for the first search result row.
ui.zwatch.row-actions-menuLocator for the row actions menu.
errorhandling.STOP_ON_ERRORStops the test if the row actions menu doesn't appear.
ui.zwatch.row-actions-add-to-compareLocator for the Add to Compare option in the actions menu.
ui.zwatch.compare-barLocator for the comparison bar reflecting the added item.

Example 3: Opening record actions in a Zoho Creator application

Right-click a lease record row in a Zoho Creator Lease Tracker application to open its actions menu.

// Open the Leases report in the Lease Tracker application using the Open URL task
openURL("https://creatorapp.zoho.com/orgname/lease-tracker#Report:Leases", "same window");
// Right-click the lease record row using the Right Click task
rightClick(ui.leasetracker.lease-record-row);
// Confirm the record actions menu appears using the Assert Visible task
assertVisible(ui.leasetracker.record-actions-menu, errorhandling.STOP_ON_ERROR);

where:


"https://creatorapp.zoho.com/orgname/lease-tracker#Report:Leases"Leases report URL.
"same window"Opens the report in the window already running the test.
ui.leasetracker.lease-record-rowLocator for the lease record row.
ui.leasetracker.record-actions-menuLocator for the record actions menu.
errorhandling.STOP_ON_ERRORStops the test if the record actions menu doesn't appear.

4. Use cases

Scenario 1: Confirming a custom context menu on a product image offers a share option

Shoppers viewing a product photo might want to share it directly rather than saving and re-uploading it elsewhere, and the product page offers this through its own right-click menu rather than the browser's built-in options.

A tester uses Zoho QEngine to right-click the image, select Share from the custom menu, and confirm the share panel appears, ensuring the sharing shortcut works as intended.


Steps
  1. Open the Diver Chronomat product page in the same window.
  2. Wait for the product image to become clickable.
  3. Right-click the product image.
  4. Select the Share option from the context menu.
  5. Confirm the share panel appears.

Implementation

// Step 1: Open the Diver Chronomat product page on the ZWatch Commerce website in the same window using the Open URL task
openURL("https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722", "same window");
// Step 2: Wait until the product image becomes clickable
wait(10, "img[alt='Diver Chronomat']", event.CLICKABLE);
// Step 3: Right-click the product image using the Right Click task
rightClick("img[alt='Diver Chronomat']");
// Step 4: Select the Share option from the context menu using the Click task
click(ui.zwatch.image-context-menu-share-option);
// Step 5: Confirm the share panel appears using the Assert Visible task
assertVisible(ui.zwatch.share-panel, errorhandling.STOP_ON_ERROR);
Scenario 2: Adding a search result to the wishlist from its actions menu

Shoppers scanning search results sometimes want to save an item for later without opening its full product page first, and a right-click menu on the result row offers that shortcut directly.

A tester uses Zoho QEngine to search for Chrono 44, right-click the result row, select Add to Wishlist, and confirm the item was saved, giving shoppers a quick way to bookmark a product while browsing search results.


Steps
  1. Open the ZWatch home page in the same window.
  2. Search for Chrono 44.
  3. Right-click the first search result row.
  4. Select Add to Wishlist from the actions menu.
  5. Confirm the wishlist confirmation message appears.

Implementation

// Step 1: Open the ZWatch Commerce home page in the same window using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Step 2: Click the search icon to reveal the search input using the Click task
click(".theme-search");
// Step 3: Enter a search term using the Set Value task
setValue("[data-search-input]", "Chrono 44");
// Step 4: Submit the search using the <Send Keys> task
sendKeys("[data-search-input]", [keys.ENTER]);
// Step 5: Right-click the first search result row using the Right Click task
rightClick(ui.zwatch.search-result-row);
// Step 6: Select Add to Wishlist from the actions menu using the Click task
click(ui.zwatch.row-actions-add-to-wishlist);
// Step 7: Confirm the wishlist confirmation message appears using the Assert Visible task
assertVisible(".wishlist-selection-container", errorhandling.STOP_ON_ERROR);
Scenario 3: Flagging an inventory item for reorder from its record actions menu

Consider a retail organization that uses a Zoho Creator Inventory Manager application to track stock. Warehouse staff right-click a product row in the Inventory report to open a quick actions menu, then choose Flag for Reorder rather than opening the full record to change its status manually. This menu is a Custom Action configured on the report, which runs a Deluge script to update the item's reorder status field.

A tester uses Zoho QEngine to right-click a record row, select Flag for Reorder from the menu, reopen the report, and confirm the reorder status was saved, ensuring low-stock items are reliably flagged for restocking.


Steps
  1. Open the Inventory report in the Inventory Manager application.
  2. Wait for the record row to be present.
  3. Right-click the record row.
  4. Select Flag for Reorder from the actions menu.
  5. Reopen the Inventory report.
  6. Confirm the record's reorder status reflects the change.

Implementation

// Step 1: Open the Inventory report in the Inventory Manager application using the Open URL task
openURL("https://creatorapp.zoho.com/<orgname>/inventory-manager#Report:Inventory", "same window");
// Step 2: Wait until the record row is present on the page
wait(10, ui.inventorymanager.record-row, event.PRESENT);
// Step 3: Right-click the record row using the Right Click task
rightClick(ui.inventorymanager.record-row);
// Step 4: Select Flag for Reorder from the actions menu using the Click task
click(ui.inventorymanager.flag-for-reorder-option);
// Step 5: Reopen the Inventory report using the Open URL task
openURL("https://creatorapp.zoho.com/<orgname>/inventory-manager#Report:Inventory", "same window");
// Step 6: Confirm the record's reorder status reflects the change using the Assert Text task
assertText(ui.inventorymanager.reorder-status-field, "Flagged", errorhandling.STOP_ON_ERROR);

5. Points to note

  1. Use Right Click only when a page reserves an interaction specifically for a right-click. For a standard single-click interaction, use the Click task instead.
  2. Confirm the result of a right-click with an assertion task, such as Assert Visible or Assert Text.
  3. Use an ID or CSS selector to locate the target element for the right-click when a unique identifier is available. Reserve XPath for cases where no reliable ID or CSS selector can pin the element down.

6. Related topics

  1. Click
  2. Double Click
  3. Hover

7. What's next

Next step
Previous step
Next step

Now that you've learned how to right-click an element using the Right Click task, learn how to hover over an element using the Hover task.


Previous step

Before learning about the Right Click task, ensure you have learned how to perform a double-click on an element using the Double Click task.