Say you have an element for which you are checking .present?
returns true
. It returns false
, but you can see it's definitely in the DOM and it returns true
for .exists?
.
This is because the element is not visible.
One possible way this might happen is that the element is in a hidden section. The HTML might, for example, have a duplicate section that is conditionally hidden and has identical structure, classes, and text.
.exists?
will pass for elements in this section.
.present?
will not.
In this case you'll want to determine which element should be the one that's visible and whether you're specifically selecting that element rather than its hidden duplicate.
|Attributes making elements invisible|
|visibility: hidden;
|
|display: none;
|
|width: 0;
and height: 0;
|
|opacity: 0;
|
|<input type="hidden">
|
|webkit-transform
properties on element or parent|