- Print
- DarkLight
Recording assertions on tooltips
Tooltip Assertion
Tooltips disappear when the user hovers out of an element. When recording, you can add a tooltip assertion in one of the following ways.
Before the tooltip assertion step, you need a hover step that causes the tooltip to appear.
How to add assertions
Tooltips are typically implemented in two main ways: using only HTML and CSS, or using JS. How you add an assertion depends on how the tooltip is implemented.
Adding an assertion to a tooltip implemented with HTML and CSS
If the tooltip is hidden using CSS and shown when hovering the parent element using HTML and CSS, select :hover
in "Force state" in Chrome DevTools. This will keep the tooltip visible and allow you to add an assertion.
Adding an assertion to a tooltip implemented with JS
If the tooltip is implemented using JS, you may be able to add an assertion in one of the following ways.
Use a mouseover snippet to display the tooltip
In the DevTools console, execute the mouse over snippet on the target element to display the tooltip, and then add an assertion.
If you cannot add an assertion using the mouseover snippet
If the tooltip displays using the mouse over snippet, but disappears when you add the assertion, you may be able to add it by doing the following:
- Get a CSS selector or XPath for the tooltip.
- Add the desired assertion to the appropriate element and save it.
- Set the CSS selector or XPath as the locator of the assertion step.
- Modify the expected value of the assertion step if necessary. For example, the expected value could be the tooltip text.
If you are still having trouble...
Please contact us. We will work with you to resolve the issue.