waitForValue

Wait for an element (selected by css selector) for the provided amount of milliseconds to have a value. If multiple elements get queried by a given selector, it returns true (or false if reverse flag is set) if at least one element has a value.

Usage

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

Parameters

Param Type Details
selector String element to wait
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 name="someInput" id="elem" value=""></input>
<script type="text/javascript">
setTimeout(function () {
document.getElementById('elem').value = 'some text';
}, 2000);
</script>
waitForValueExample.js
1
2
3
4
5
6
7
it('should detect when element has value', function () {
browser.waitForValue('#elem', 3000);

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

Uses