- Print
- DarkLight
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;
, visibility: hidden;
or opacity: 0;
, 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.