Consider this:
val element = ...
String str = element.getAttribute("innerHTML")
So in case i only wants to get this value
is it enough to use presenceOfElementLocated()
instead of visibilityOfElementLocated()
?
You can use both presenceOfElementLocated
or visibilityOfElementLocated
to get the value
.
But for the performance perspective, I would guess that presenceOfElementLocated
will be slightly faster because it's just check that an element is present on the DOM of a page. This does not necessarily mean that the element is visible. while the visibilityOfElementLocated
has to check that an element is present on the DOM of a page and visible. Visibility means that the element is not only displayed but also has a height and width that is greater than 0.
So according to your case use of presenceOfElementLocated
will be enough.
you can consider the following point to choose appropriate method depending on your use case.
use presenceOfElementLocated
when you don't care whether if element
visible or not, you just need to know if it's on the page.
use visibilityOfElementLocated
when you need to find element which
should be also visible.
Hope it will help you..:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With