- Can I assert that an element is not on the page?
- Can I assert against an element that only appears on hover?
- Can I assert against an SVG element?
- Can I assert against CSS properties?
- Can I assert that a page or image has fully loaded?
- Can I assert that the date is the current day?
If you want to assert that an element does not exist on the page, depending on the circumstances, you can take one of the following approaches:
- Work backwards: Create an "is not present" assertion while the element is still on the page. The assertion runs after being created and fails. Move the step to the position in your test where you expect it to be absent. See an example of this strategy in the following animation.
- 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.
If the element only appears briefly or disappears when you try to record an assertion step, consider trying one of the following workarounds:
- If the tooltip is clickable, record a click step on the tooltip and convert that step into an assertion using assert on element
- If you are familiar with CSS or XPath selectors, you can try creating a custom find assertion.
Yes, the mabl Trainer can record clicks and assertions against
<svg> elements and elements within an SVG.
The mabl Trainer cannot record clicks or assertions on specific coordinates within
Yes, the mabl Trainer supports CSS assertions. When creating an element assertion, click on the "CSS" tab to select the property that you want to assert against.
If you are asserting against anything measured in px on the page, keep in mind the following considerations:
- Different browsers handle relative sizing slightly differently. Anything measured in
px, such as
border-top, may return slightly different values when run across different browsers. In this situation, we suggest using two CSS assertions - one using the “greater than” assertion type and one using the “less than” assertion type - to specify an acceptable range for your elements.
- Your application may size elements differently depending on your viewport. If you want to assert against
border-top, or any other property that is measured in
px, set the viewport size before running your assertion. Otherwise you may get inconsistent values during your assertions.
CSS assertions against images are not supported.
There is no direct way to assert whether a page or image has fully loaded. One workaround is to assert on an element, element property, or element attribute that consistently indicates that the page or image is fully loaded. Ultimately, it depends on how your page works
Updated 8 months ago