The context to run the watcher in
The selector to watch
The value to wait for
Optional
options: WaitValueOptionsThe options to pass to the waitForValueChange function and watcher.
A promise that resolves to the element handler of the input when its value matches the target value. If the value does not match within the specified or default timeout, the promise may reject.
const selector = '#username-input';
const targetValue = 'John Connor';
waitForValue(ctx, selector, targetValue)
.then((inputElement) => {
console.log('Target value reached!', inputElement);
})
.catch((error) => {
console.error('Failed to reach target value:', error);
});
Watches for the value of an input element to match the value provided.