Reputation: 1280
So sometimes when i want to click
on WebElement i am using elementToBeClickable
.
Now when i want to get text
etc. i have 2 options (maybe more ???) that i usually use:
presenceOfElementLocated
- An expectation for checking that an element is present on the DOM of a page.
visibilityOfElementLocated
- An expectation for checking that an element is present on the DOM of a page and visible.
My questions:
ExpectedCondition
?Upvotes: 1
Views: 158
Reputation: 473793
presenceOfElementLocated
would just wait for the presence of an element in the DOM tree.
visibilityOfElementLocated
would not only ensure that an element is present, but also check if the element is displayed. The logic behind the visibility determination is described here:
Which Expected Condition to use is not that simple as in case of elementToBeClickable
and a button needed to be clicked - in this case depends on the actual use case - how the desired element is loaded, is it loaded with the text, or the text is set later and dynamically etc.
There is also textToBePresentInElement
which might be more suitable, but it requires you to know a part of the element's text.
And, there is always an option to write a custom Expected Condition - for instance, you can wait for any text to be present in element.
Upvotes: 1