Frequently Asked Questions about Assertions
1. What is the difference between "Page Should Contain Element" and "Element Should Be Visible"?
"Page Should Contain Element" succeeds if the target element is present in the HTML code.
Whether the element is visible or not doesn't affect the result: success or failure.
Note that it succeeds even if the element is not visible on the page, if it is invisible, or if it exists on the negative coordinate.
"Element Should Be Visible" succeeds if the target element is visible and exists.
It will fail if the element is not visible, such as display: none or hidden, even if it is present in the HTML code.
Both commands can be set to a wide range of values.
For example, if you want to see a particular form after performing a particular operation, you can select the entire form and use one of the above commands to confirm the purpose of the operation.
However, this command only checks whether the element exists and whether it is visible.
It cannot be used to check if all elements in the area are correct.
If you need to check the correctness of the displayed content, please set a separate command for each element.
2. Is it possible to check that the specified element does not exist?
If the element you want to check does not exist contains a string, you can use "Page Should Not Contain" or "Element Should Not Contain".
"Page Should Not Contain"
will check the entire page to make sure that no specific text is present, and
"Element Should Not Contain"
checks for the presence of a specific string within a specific element.
For example, if you are logged in with an administrator account and you want to see the string ADMIN that indicates that you are an administrator, but you are logged in with a regular user account and you don't want this string to appear on the page at all, you can use "Page Should Not Contain".
If you want to make sure that a particular string does not appear in a particular element, such as in a form or on a menu bar, you can use "Element Should Not Contain".
If you want to make sure that text is not present in an element that does not contain text or is difficult to determine by text, please contact our support team.