Element assertion FAQs

Commonly asked questions about element assertions

Can I assert that an element is not on the page?

If you want to assert that an element is on the page, depending on the circumstances, you can take one of the following approaches:

  1. Work backwards: Create an "is not present" assertion while the element is still on the page. (The assertion will run after being created and fail.) Move the step to the position in your test where you expect it to be absent.
  2. Use a custom find assertion: If the element doesn't appear during testing, but you can identify it with CSS or XPath, you can record a custom find assertion and select the "is not present" assertion type.

Working backwards to create an "is not present" assertion

Can I assert against an element that only appears on hover?

If the element only appears briefly or disappears when you try to record an assertion step, consider trying one of the following workarounds:

  1. If the tooltip is clickable, record a click step on the tooltip and convert that step into an assertion using assert on element
  2. If you are familiar with CSS or XPath selectors, you can try creating a custom find assertion.

Can I assert against an SVG element?

Currently, mabl cannot interact directly with SVG elements. Depending on what your end goal is, you might consider one of the following workarounds:

  • Asserting on the element that contains the SVG element (the parent element).
  • If you want to assert on an SVG element's attributes, you can try creating this two-step workaround:
    • Create a variable from JavaScript. Use/modify this snippet to extract properties from the SVG element.
    • Make an assertion against the variable value.

If you need a different type of support for SVG assertions, please let us know in the mabl Product Portal.

Can I assert against CSS properties?

CSS style properties are not included in the element assertion menu. One workaround is to use a JavaScript snippet. Click here for more information.


Under consideration

This feature is currently listed as "Under Consideration" in the mabl Product Portal. If you would like to see support for assertions against CSS properties without using JavaScript, you can add your feedback here.

Can I assert that a page or image has fully loaded?

There is no direct way to assert whether a page or image has fully loaded. If there is an element or element property/attribute in the DOM that consistently indicates that the page/image is fully loaded, it could be used as a workaround to assert "loadedness." Ultimately, it depends on how your page works

Can I assert that the date is the current day?

If an application shows the current date in a specific format, you can create an assertion with some help from JavaScript. See our guide on working with dates in mabl for more information.

Did this page help you?