Skip to content

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

ParameterTypeDescription
ctxContextContext object.
specWaitForWatchSpec<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);

Matterway Assistant SDK Documentation