waitForEnabled

Wait for an element (selected by css selector) for the provided amount of milliseconds to be (dis/en)abled. If multiple elements get queryied by given selector, it returns true (or false if reverse flag is set) if at least one element is (dis/en)abled.

Usage

1
browser.waitForEnabled(selector[,ms][,reverse]);

Parameters

Param Type Details
selector String element to wait for
ms
optional
Number time in ms (default: 500)
reverse
optional
Boolean if true it waits for the opposite (default: false)

Example

index.html
1
2
3
4
5
6
<input type="text" id="username" value="foobar" disabled="disabled"></input>
<script type="text/javascript">
setTimeout(function () {
document.getElementById('username').disabled = false
}, 2000);
</script>
waitForEnabledExample.js
1
2
3
4
5
6
7
it('should detect when element is enabled', function () {
browser.waitForEnabled('#username', 3000);

// same as
elem = $('#username');
elem.waitForEnabled(3000)
});

Uses