Recently diving into Protractor, I'm aiming to set up an expect statement like so:
expect(elementIsVisible).toBe(true);
While exploring the EC (expected conditions) section in Protractor, specifically EC.visibilityOf
, I find myself unsure about the return value of visibilityOf
.
The documentation seems quite cryptic to me:
RETURNS
+-----------+-------------------------------------------------------------------------------------------+
| Type | Description |
+-----------+-------------------------------------------------------------------------------------------+
| !function | An expected condition that returns a promise representing whether the element is visible. |
+-----------+-------------------------------------------------------------------------------------------+
So what exactly does it return - a Promise
or an expected condition?
Given that attempting to chain a .then
results in a then is not a function
error, indicating it might be returning an expected condition. But what does that mean?
In all the examples in Protractor's documentation, this return value is utilized with browser.wait
functions.
However, my intention differs as I prefer having a straightforward true
/false
outcome in my expect
statement.
Trying to gather further insights from Selenium's examples, I found that Protractor (a JavaScript implementation) redirects to Java documentation...