waitForElementVisible() produces false fails

Luckily, the waitForElementVisible() method not only waits for the element to become visible within some timeout, but it also returns a boolean value based on the result.

So in your script, you can also ensure that the element was found and is visible (within the wait period) by asserting the result of the method call. I.e.:

assert waitForElementVisible(datePickerObject, 30);

This step will pass if the element is found and is visible within 30 seconds, and fail otherwise.

The verifyElementVisible() method basically handles this assertion for you, and checks for an element’s visibility right away.