Appearance
Function: waitForValueChange()
ts
function waitForValueChange(
ctx: Context,
selector: string,
waitOptions?: WaitValueOptions): Promise<ElementHandle<Element> | null>;Defined in: src/wait/waiters/waitForValueChange.ts:28
Wait for the value of an input element to change.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
selector | string | CSS selector for the input element. |
waitOptions? | WaitValueOptions | Timeout, polling, and initial value settings. |
Returns
Promise<ElementHandle<Element> | null>
The element handle after the value changes.
Example
ts
// Wait for the search box to get new text
const handle = await waitForValueChange(ctx, '#search-box', {
timeout: 5000,
polling: 100,
initialValue: '',
});
console.log('Search text changed!', handle);