In a nutshell
The Hover task moves the mouse pointer over a web element during test execution. The browser registers this as a hover state, which may cause the web application to display or update content. Use this task when a test case needs to confirm hover-triggered content, such as a tooltip appearing, a preview panel revealing details, or a navigation menu expanding.
The Hover task registers as a distinct state in the browser, separate from a click, whenever the pointer rests on an element during test execution. The web application may respond to that state by displaying or updating content, such as a status icon revealing guidance, a submenu expanding from a navigation item, or extra details surfacing on a product thumbnail.
Note: Since the Hover task doesn't perform a click action, follow it with an appropriate <assertion>, such as Assert Visible or Assert Text, to verify that the expected UI change occurred.hover(<locator>);
| Parameter | Data Type | Description |
| locator | STRING | Identifies the element to hover over. Note: Locators can be fetched in one of two ways, either by manually inspecting the webpage to identify the element, or by using a recorded element saved during a recording session. Learn more about Elements |
When a user hovers over the shipping info icon on the product page, a tooltip appears explaining the delivery timelines.
// Open the Diver Chronomat product page on the ZWatch Commerce website using the Open URL task
openURL("https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722", "same window");
// Hover over the shipping info icon using the Hover task
hover(".theme-shipping-info-icon");
// Confirm the shipping tooltip becomes visible using the Assert Visible task
assertVisible(".theme-shipping-tooltip", errorhandling.STOP_ON_ERROR);where:
| "https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722" | URL of the Diver Chronomat product page. |
| "same window" | Opens the page in the window already running the test. |
| .theme-shipping-info-icon | Locator for the shipping info icon on the product page. |
| .theme-shipping-tooltip | Locator for the tooltip revealed by hovering over the shipping info icon. |
| errorhandling.STOP_ON_ERROR | Stops the test case if the shipping tooltip isn't visible. |
Preview the Blue Bay GMT product by hovering over its product card to reveal the Quick View button, then wait for it to become clickable.
// Open the ZWatch Commerce home page using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Click the link to the shop page using the Click task
click("a[href*='all-products']");
// Hover over the Blue Bay GMT product link using the Hover task
hover("a[href='/products/blue-bay-gmt/3531661000000075668']");
// Wait until the quick-view button becomes clickable
wait(5, "[data-zs-product-url='/products/blue-bay-gmt/3531661000000075668']", event.CLICKABLE);
// Confirm the quick-view button is visible using the Assert Visible task
assertVisible("[data-zs-product-url='/products/blue-bay-gmt/3531661000000075668']", 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. |
| a[href*='all-products'] | Locator for the link to the shop page. |
| a[href='/products/blue-bay-gmt/3531661000000075668'] | Locator for the Blue Bay GMT product link on its product card. |
| 5 | Maximum time to wait for the quick-view button to become clickable, in seconds. |
| [data-zs-product-url='/products/blue-bay-gmt/3531661000000075668'] | Locator for the Blue Bay GMT quick-view button, hidden until the product link is hovered. |
| event.CLICKABLE | Waits until the quick-view button becomes clickable. |
| errorhandling.STOP_ON_ERROR | Stops the test case if the quick-view button isn't visible. |
On a Sales Insights application's Product Overview page, hovering over a product card reveals its current stock level without opening the full record.
// Open the Product Overview page in a Zoho Creator Sales Insights application using the Open URL task
openURL("https://creatorapp.zoho.com/<orgname>/sales-insights#Page:Product_Overview", "same window");
// Hover over the product card using the Hover task
hover(ui.salesinsights.product-card);
// Confirm the stock level is visible using the Assert Visible task
assertVisible(ui.salesinsights.stock-level-detail, errorhandling.STOP_ON_ERROR);where:
| "https://creatorapp.zoho.com/<orgname>/sales-insights#Page:Product_Overview" | URL of the Product Overview page in a Zoho Creator Sales Insights application. |
| "same window" | Opens the page in the window already running the test. |
| ui.salesinsights.product-card | Locator for the product card. |
| ui.salesinsights.stock-level-detail | Locator for the stock level detail revealed by hovering over the card. |
| errorhandling.STOP_ON_ERROR | Stops the test case if the stock level detail isn't visible. |
Shoppers browsing the shop page often hover over a product to preview it, and the quick-view overlay should let them add the item to the cart directly, without opening the full product page.
A tester uses Zoho QEngine to confirm that hovering over a product reveals its quick-view button so shoppers can add the product to the cart directly from the quick-view overlay.
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 link to the shop page using the Click task
click("a[href*='all-products']");
// Step 3: Hover over the Diver Chronomat product link using the Hover task
hover("a[href='/products/diver-chronomat/3531661000000075722']");
// Step 4: Click the quick-view button that appears using the Click task
click("[data-zs-product-url='/products/diver-chronomat/3531661000000075722']");
// Step 5: Add the product to the cart from within the quick-view overlay using the Click task
click(".theme-quick-view-container .theme-product-qty-and-add-cart");
// Step 6: Confirm the cart success message appears using the Assert Visible task
assertVisible(".theme-cart-add-success-message", errorhandling.STOP_ON_ERROR);Shoppers browsing the site expect hovering over a top-level navigation item, such as Watches, to reveal a submenu listing its categories, without needing a click to expand it.
A tester uses Zoho QEngine to confirm that hovering over the Watches navigation item reveals a submenu containing the Diver, Chronograph, and Dress category links.
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: Hover over the Watches navigation item using the Hover task
hover("a[href*='watches-menu']");
// Step 3: Confirm the submenu is visible using the Assert Visible task
assertVisible(".theme-nav-submenu", errorhandling.STOP_ON_ERROR);
// Step 4: Confirm the submenu contains the Diver category link using the Assert Visible task
assertVisible("a[href*='diver-category']", errorhandling.STOP_ON_ERROR);Consider an Expense Tracker application that finance staff use to review submitted expenses. The Expense Summary report includes a chart view that plots total expenses by category. Staff hover over a chart segment to check the exact total for a category before deciding whether to investigate further.
A tester uses Zoho QEngine to confirm that hovering over a chart segment reveals the correct category total in the data popup, so staff can trust the figure shown before deciding whether a category needs a closer look.
Implementation
// Step 1: Open the Expense Summary report in a Zoho Creator Expense Tracker application using the Open URL task
openURL("https://creatorapp.zoho.com/<orgname>/expense-tracker#Report:Expense_Summary", "same window");
// Step 2: Wait until the Travel category's chart segment is present
wait(10, ui.expensetracker.travel-chart-segment, event.PRESENT);
// Step 3: Hover over the Travel category's chart segment using the Hover task
hover(ui.expensetracker.travel-chart-segment);
// Step 4: Confirm the data popup displays the correct total for the Travel category using the Assert Text task
assertText(ui.expensetracker.chart-data-popup, "$4,250", errorhandling.STOP_ON_ERROR);Now that you've learned how to hover over an element using the Hover task, learn how to hover over an element and then click it in one action using the Hover and Click task.
Before using the Hover task, ensure that you've learned how to send keystrokes to an element using the Send Keys task.