waitForExist
Wait for an element for the provided amount of milliseconds to be present within the DOM. Returns true if the selector matches at least one element that exists in the DOM, otherwise throws an error. If the reverse flag is true, the command will instead return true if the selector does not match any elements.
Usage
browser.waitForExist(ms, reverse)
Parameters
Param | Type | Details |
---|---|---|
ms optional | param | time in ms (default: 500) |
reverse optional | param | if true it instead waits for the selector to not match any elements (default: false) |
Example
it('should display a notification message after successful form submit', function () {
const form = $('form');
const notification = $('.notification');
form.submit();
notification.waitForExist(5000); // same as `browser.waitForExist('.notification', 5000)`
expect(notification.getText()).to.be.equal('Data transmitted successfully!')
});