Appearance
Function: waitForWatch()
ts
function waitForWatch<T>(ctx: Context, spec: WaitForWatchSpec<T>): Promise<T>;Defined in: src/wait/waiters/waitForWatch.ts:27
Wait for a watcher to match and resolve with the value.
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | Context | Context object. |
spec | WaitForWatchSpec<T> | Wait and match functions. |
Returns
Promise<T>
The matched value.
Example
ts
const result = await waitForWatch(ctx, {
wait: async () => await ctx.waitForSelector('#trophy'),
match: async () => await ctx.page.$('#trophy'),
});
console.log('Trophy unlocked!', result);