Article Overview:
This article will cover how you can achieve the following:
In some cases during test automation, an assertion might fail even though the element is present on the page. This can occur due to several reasons, including timing issues, improper element locators, visibility problems, or dynamic content loading. This knowledge base article will help troubleshoot and resolve assertion failures by identifying common causes and providing solutions
Problem Statement:
You may encounter situations where an assertion fails during automation testing, even though the element you're trying to assert on is present on the application page. Some common causes for this issue include:
- Timing issues (the element is not ready or visible when checked).
- Incorrect locators or finding the wrong element.
- Element visibility or accessibility problems.
- DOM changes or asynchronous content loading.
Issue Example :
In above Screenshot "11" present on application still assertion failed.
Solution:
You can use workaround as follows to solve this issue:
Steps:
-
- Locate the element near the required text value i.e. "Section Start Date"
- Find the label or text element containing "Section Start Date" on the page. This will act as a reference point for the associated input field.
- Example NLP steps:
1. Look for element "Section Start Date" on page.
.
-
Locate the associated text box (DD):
- After finding the "Section Start Date" element, locate the text box element (
<input>
or similar) that is near this label. The text box is named "DD," and you'll check its value. - Example NLP steps:
1. Look for input "DD"
- After finding the "Section Start Date" element, locate the text box element (
-
Validate the value inside the "DD" text box:
- Assert that the value inside the "DD" text box equals "11".
- Example NLP steps:
1. Assert that element "DD" equals "11".
In case of any further queries, additions, or support please contact our Virtuoso Support Team.
Comments
0 comments
Please sign in to leave a comment.