puppeteer/website/versioned_docs/version-17.1.3/api/puppeteer.page.waitforframe.md
release-please[bot] 9b120f6c7b
chore(main): release 17.1.3 (#8921)
* chore(main): release 17.1.3

* chore: generate versioned docs

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
2022-09-08 13:16:39 +00:00

1.4 KiB

sidebar_label
Page.waitForFrame

Page.waitForFrame() method

Signature:

class Page {
  waitForFrame(
    urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>),
    options?: {
      timeout?: number;
    }
  ): Promise<Frame>;
}

Parameters

Parameter Type Description
urlOrPredicate string | ((frame: Frame) => boolean | Promise<boolean>) A URL or predicate to wait for.
options { timeout?: number; } (Optional) Optional waiting parameters

Returns:

Promise<Frame>

Promise which resolves to the matched frame.

Remarks

Optional Parameter have:

  • timeout: Maximum wait time in milliseconds, defaults to 30 seconds, pass 0 to disable the timeout. The default value can be changed by using the Page.setDefaultTimeout() method.

Example

const frame = await page.waitForFrame(async frame => {
  return frame.name() === 'Test';
});