Recording assertions on tooltips
  • 01 Mar 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light

Recording assertions on tooltips

  • Dark
    Light

Article Summary

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.

Hover step

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.

force-state-hover

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:

  1. Get a CSS selector or XPath for the tooltip.
  2. Add the desired assertion to the appropriate element and save it.
  3. Set the CSS selector or XPath as the locator of the assertion step.
  4. 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.


Was this article helpful?

Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.