Below given are some of the most common issues while using the Text verification NLP Grammar.
Verified Text is not present on the page
The Element Type selected in the NLP Statement is incorrect
The provided verification Text and actual Text in HTML are different
The text in the HTML contains White spaces
Comparison with incorrect Case
1. Verified Text is not present on the page
The very first step would be to check if the text is actually present on the page or not. Please check the screenshot next to the failed Step to see whether the current page contains the specified Text. This solution is pretty straightforward.
2. The Element Type selected in the NLP Statement is incorrect
In the below example, we are using the NLP Statement 'Click on button with text Go to Travel'. To the user, the element with the text 'Go to Travel' seems like a button but the developer created it as a link(an anchor element).
Since, this element is actually a link, the test looks only for button elements in the page and therefore fails to find it.
Specify the element type only after checking it in the HTML source or use the generic templates such as 'Click on element with text Go to Travel'.
3. The provided verification Text and actual Text in HTML are different
The text in the HTML Source is given in lowercase but its shown in the page in a different format(case).
As you can see, the actual text in the Div element is all in lowercase. Developer used CSS Transformation to represent the text in different ways in the UI.
While automating your application, if you are facing an error with Text Verification, please use the actual text contained inside the HTML Code instead of copying from the page.
4. The text in the HTML contains White spaces
In some cases, the actual text inside the HTML Code contains white spaces and these are ignored when text is copied from the page.
As you can see, the HTML text contains white-spaces and if we don't use the exact text in Test Step, it might fail during comparison.
Use the Text Verification NLP Grammar using 'contains text' such as:
- Verify that the current page title contains test data
- Verify that the current page URL contains test data
- Verify that the element ui identifier displays text contains test data
and so on...
If the Grammar you are using doesn't have a 'contains' counterpart, please use the contains function in the XPath for the element - XPath String Functions
5. Comparison with incorrect Case
Text Comparison templates on Testsigma are case sensitive. Please check and confirm that the verification Text test data is exactly the same case as the Text on the Web page. For example, if the page displays text as "DashBoard" and user is giving the test data as "Dashboard" in the Test step, the step will fail due to the text mismatch.
Copy the verification text from the HTML Source so as to get the correct Text.