@types/puppeteer

  • Version 5.4.3
  • Published
  • 89.3 kB
  • 1 dependency
  • MIT license

Install

npm i @types/puppeteer
yarn add @types/puppeteer
pnpm add @types/puppeteer

Overview

TypeScript definitions for puppeteer

Index

Variables

Functions

Interfaces

Type Aliases

Namespaces

Variables

variable devices

const devices: { [name: string]: devices.Device };

    variable product

    const product: Product;
    • The name of the browser that is under automation ("chrome" or "firefox")

      The product is set by the PUPPETEER_PRODUCT environment variable or the product option in puppeteer.launch([options]) and defaults to chrome. Firefox support is experimental.

    Functions

    function clearCustomQueryHandlers

    clearCustomQueryHandlers: () => void;
    • Clears all registered handlers.

    function connect

    connect: (options?: ConnectOptions) => Promise<Browser>;
    • Attaches Puppeteer to an existing Chromium instance

    function createBrowserFetcher

    createBrowserFetcher: (options?: FetcherOptions) => BrowserFetcher;
    • This methods attaches Puppeteer to an existing Chromium instance.

    function customQueryHandlerNames

    customQueryHandlerNames: () => string[];
    • Returns

      a list with the names of all registered custom query handlers.

    function defaultArgs

    defaultArgs: (options?: ChromeArgOptions) => string[];
    • The default flags that Chromium will be launched with

    function executablePath

    executablePath: () => string;
    • Path where Puppeteer expects to find bundled Chromium

    function launch

    launch: (options?: LaunchOptions) => Promise<Browser>;
    • The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed.

    function registerCustomQueryHandler

    registerCustomQueryHandler: (
    name: string,
    queryHandler: CustomQueryHandler
    ) => void;
    • Registers a custom query handler. After registration, the handler can be used everywhere where a selector is expected by prepending the selection string with <name>/. The name is only allowed to consist of lower- and upper case latin letters.

      Parameter name

      The name that the custom query handler will be registered under.

      Parameter queryHandler

      The custom query handler to register.

      Example 1

      puppeteer.registerCustomQueryHandler('text', { … });
      const aHandle = await page.$('text/…');

    function unregisterCustomQueryHandler

    unregisterCustomQueryHandler: (name: string) => void;
    • Parameter name

      The name of the query handler to unregistered.

    Interfaces

    interface Accessibility

    interface Accessibility {}
    • The Accessibility class provides methods for inspecting Chromium's accessibility tree. The accessibility tree is used by assistive technology such as screen readers. Accessibility is a very platform-specific thing. On different platforms, there are different screen readers that might have wildly different output. Blink - Chrome's rendering engine - has a concept of "accessibility tree", which is than translated into different platform-specific APIs. Accessibility namespace gives users access to the Blink Accessibility Tree. Most of the accessibility tree gets filtered out when converting from Blink AX Tree to Platform-specific AX-Tree or by screen readers themselves. By default, Puppeteer tries to approximate this filtering, exposing only the "interesting" nodes of the tree.

    method snapshot

    snapshot: (options?: SnapshopOptions) => Promise<AXNode>;

      interface AuthOptions

      interface AuthOptions {}

        property password

        password: string;

          property username

          username: string;

            interface AXNode

            interface AXNode {}

              property autocomplete

              autocomplete: string;
              • What kind of autocomplete is supported by a control.

              property checked

              checked: boolean | 'mixed';
              • Whether the checkbox is checked, or "mixed".

              property children

              children: AXNode[];
              • Child nodes of this node, if any.

              property description

              description: string;
              • An additional human readable description of the node.

              property disabled

              disabled: boolean;
              • Whether the node is disabled.

              property expanded

              expanded: boolean;
              • Whether the node is expanded or collapsed.

              property focused

              focused: boolean;
              • Whether the node is focused.

              property haspopup

              haspopup: string;
              • What kind of popup is currently being shown for a node.

              property invalid

              invalid: string;
              • Whether and in what way this node's value is invalid.

              property keyshortcuts

              keyshortcuts: string;
              • Keyboard shortcuts associated with this node.

              property level

              level: number;
              • The level of a heading.

              property modal

              modal: boolean;
              • Whether the node is modal.

              property multiline

              multiline: boolean;
              • Whether the node text input supports multiline.

              property multiselectable

              multiselectable: boolean;
              • Whether more than one child can be selected.

              property name

              name: string;
              • A human readable name for the node.

              property orientation

              orientation: string;
              • Whether the node is oriented horizontally or vertically.

              property pressed

              pressed: boolean | 'mixed';
              • Whether the toggle button is checked, or "mixed".

              property readonly

              readonly: boolean;
              • Whether the node is read only.

              property required

              required: boolean;
              • Whether the node is required.

              property role

              role: string;
              • The role.

              property roledescription

              roledescription: string;
              • A human readable alternative to the role.

              property selected

              selected: boolean;
              • Whether the node is selected in its parent node.

              property value

              value: string | number;
              • The current value of the node.

              property valuemax

              valuemax: number;
              • The maximum value in a node.

              property valuemin

              valuemin: number;
              • The minimum value in a node.

              property valuetext

              valuetext: string;
              • A description of the current value.

              interface Base64ScreenShotOptions

              interface Base64ScreenShotOptions extends ScreenshotOptions {}

                property encoding

                encoding: 'base64';

                  interface BinaryScreenShotOptions

                  interface BinaryScreenShotOptions extends ScreenshotOptions {}

                    property encoding

                    encoding?: 'binary';

                      interface BoundingBox

                      interface BoundingBox {}

                        property height

                        height: number;
                        • The height.

                        property width

                        width: number;
                        • The width.

                        property x

                        x: number;
                        • The x-coordinate of top-left corner.

                        property y

                        y: number;
                        • The y-coordinate of top-left corner.

                        interface Box

                        interface Box {}

                          property x

                          x: number;

                            property y

                            y: number;

                              interface BoxModel

                              interface BoxModel {}

                                property border

                                border: Box[];
                                • Border box, represented as an array of {x, y} points.

                                property content

                                content: Box[];
                                • Content box, represented as an array of {x, y} points.

                                property height

                                height: number;

                                  property margin

                                  margin: Box[];
                                  • Margin box, represented as an array of {x, y} points.

                                  property padding

                                  padding: Box[];
                                  • Padding box, represented as an array of {x, y} points.

                                  property width

                                  width: number;

                                    interface Browser

                                    interface Browser extends EventEmitter, TargetAwaiter {}
                                    • A Browser is created when Puppeteer connects to a Chromium instance, either through puppeteer.launch or puppeteer.connect.

                                    method browserContexts

                                    browserContexts: () => BrowserContext[];
                                    • Returns an array of all open browser contexts. In a newly created browser, this will return a single instance of BrowserContext.

                                    method close

                                    close: () => Promise<void>;
                                    • Closes browser with all the pages (if any were opened). The browser object itself is considered to be disposed and can not be used anymore.

                                    method createIncognitoBrowserContext

                                    createIncognitoBrowserContext: () => Promise<BrowserContext>;
                                    • Creates a new incognito browser context. This won't share cookies/cache with other browser contexts.

                                    method defaultBrowserContext

                                    defaultBrowserContext: () => BrowserContext;
                                    • Returns the default browser context. The default browser context can not be closed.

                                    method disconnect

                                    disconnect: () => void;
                                    • Disconnects Puppeteer from the browser, but leaves the Chromium process running. After calling disconnect, the browser object is considered disposed and cannot be used anymore.

                                    method isConnected

                                    isConnected: () => boolean;
                                    • Indicates that the browser is connected.

                                    method newPage

                                    newPage: () => Promise<Page>;
                                    • Promise which resolves to a new Page object.

                                    method on

                                    on: <K extends keyof BrowserEventObj>(
                                    eventName: K,
                                    handler: (e: BrowserEventObj[K], ...args: any[]) => void
                                    ) => this;
                                    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

                                      Parameter event

                                      The name of the event.

                                      Parameter handler

                                      The callback function.

                                    method once

                                    once: <K extends keyof BrowserEventObj>(
                                    eventName: K,
                                    handler: (e: BrowserEventObj[K], ...args: any[]) => void
                                    ) => this;
                                    • Adds a one time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

                                      Parameter event

                                      The name of the event.

                                      Parameter handler

                                      The callback function.

                                    method pages

                                    pages: () => Promise<Page[]>;
                                    • Promise which resolves to an array of all open pages.

                                    method process

                                    process: () => any;
                                    • Spawned browser process. Returns null if the browser instance was created with puppeteer.connect method

                                    method target

                                    target: () => Target;
                                    • A target associated with the browser.

                                    method targets

                                    targets: () => Promise<Target[]>;
                                    • Promise which resolves to an array of all active targets.

                                    method userAgent

                                    userAgent: () => Promise<string>;
                                    • Promise which resolves to the browser's original user agent. **NOTE** Pages can override browser user agent with page.setUserAgent.

                                    method version

                                    version: () => Promise<string>;
                                    • For headless Chromium, this is similar to HeadlessChrome/61.0.3153.0. For non-headless, this is similar to Chrome/61.0.3153.0.

                                    method wsEndpoint

                                    wsEndpoint: () => string;
                                    • Browser websocket endpoint which can be used as an argument to puppeteer.connect. The format is ws://${host}:${port}/devtools/browser/

                                    interface BrowserContext

                                    interface BrowserContext extends EventEmitter, TargetAwaiter {}
                                    • BrowserContexts provide a way to operate multiple independent browser sessions. When a browser is launched, it has a single BrowserContext used by default. The method browser.newPage() creates a page in the default browser context.

                                    method browser

                                    browser: () => Browser;
                                    • The browser this browser context belongs to.

                                    method clearPermissionOverrides

                                    clearPermissionOverrides: () => Promise<void>;
                                    • Clears all permission overrides for the browser context.

                                    method close

                                    close: () => Promise<void>;
                                    • Closes the browser context. All the targets that belong to the browser context will be closed.

                                    method isIncognito

                                    isIncognito: () => boolean;
                                    • Returns whether BrowserContext is incognito. The default browser context is the only non-incognito browser context.

                                    method newPage

                                    newPage: () => Promise<Page>;
                                    • Creates a new page in the browser context.

                                    method on

                                    on: <K extends keyof BrowserContextEventObj>(
                                    eventName: K,
                                    handler: (e: BrowserContextEventObj[K], ...args: any[]) => void
                                    ) => this;
                                    • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

                                      Parameter event

                                      The name of the event.

                                      Parameter handler

                                      The callback function.

                                    method once

                                    once: <K extends keyof BrowserContextEventObj>(
                                    eventName: K,
                                    handler: (e: BrowserContextEventObj[K], ...args: any[]) => void
                                    ) => this;
                                    • Adds a one time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

                                      Parameter event

                                      The name of the event.

                                      Parameter handler

                                      The callback function.

                                    method overridePermissions

                                    overridePermissions: (
                                    origin: string,
                                    permissions: Permission[]
                                    ) => Promise<void>;
                                    • Parameter origin

                                      The origin to grant permissions to, e.g. "https://example.com".

                                      Parameter permissions

                                      An array of permissions to grant. All permissions that are not listed here will be automatically denied.

                                    method pages

                                    pages: () => Promise<Page[]>;
                                    • Promise which resolves to an array of all open pages.

                                    method targets

                                    targets: () => Target[];
                                    • An array of all active targets inside the browser context.

                                    interface BrowserContextEventObj

                                    interface BrowserContextEventObj {}

                                      property targetchanged

                                      targetchanged: Target;
                                      • Emitted when the url of a target inside the browser context changes.

                                      property targetcreated

                                      targetcreated: Target;
                                      • Emitted when a target is created, for example when a new page is opened by window.open or browserContext.newPage.

                                      property targetdestroyed

                                      targetdestroyed: Target;
                                      • Emitted when a target is destroyed, for example when a page is closed.

                                      interface BrowserEventObj

                                      interface BrowserEventObj {}

                                        property disconnected

                                        disconnected: undefined;
                                        • Emitted when puppeteer gets disconnected from the browser instance.

                                        property targetchanged

                                        targetchanged: Target;
                                        • Emitted when the url of a target changes.

                                        property targetcreated

                                        targetcreated: Target;
                                        • Emitted when a target is created, for example when a new page is opened by window.open or browser.newPage.

                                        property targetdestroyed

                                        targetdestroyed: Target;
                                        • Emitted when a target is destroyed, for example when a page is closed.

                                        interface BrowserFetcher

                                        interface BrowserFetcher {}
                                        • BrowserFetcher can download and manage different versions of Chromium.

                                        method canDownload

                                        canDownload: (revision: string) => Promise<boolean>;
                                        • The method initiates a HEAD request to check if the revision is available.

                                        method download

                                        download: (
                                        revision: string,
                                        progressCallback?: (downloadBytes: number, totalBytes: number) => void
                                        ) => Promise<RevisionInfo>;
                                        • The method initiates a GET request to download the revision from the host.

                                        method localRevisions

                                        localRevisions: () => Promise<string[]>;

                                          method platform

                                          platform: () => Platform;

                                            method product

                                            product: () => Product;

                                              method remove

                                              remove: (revision: string) => Promise<void>;

                                                method revisionInfo

                                                revisionInfo: (revision: string) => RevisionInfo;

                                                  interface BrowserOptions

                                                  interface BrowserOptions {}

                                                    property defaultViewport

                                                    defaultViewport?: {
                                                    /**
                                                    * page width in pixels.
                                                    */
                                                    width?: number;
                                                    /**
                                                    * page height in pixels.
                                                    */
                                                    height?: number;
                                                    /**
                                                    * Specify device scale factor (can be thought of as dpr).
                                                    * @default 1
                                                    */
                                                    deviceScaleFactor?: number;
                                                    /**
                                                    * Whether the meta viewport tag is taken into account.
                                                    * @default false
                                                    */
                                                    isMobile?: boolean;
                                                    /**
                                                    * Specifies if viewport supports touch events.
                                                    * @default false
                                                    */
                                                    hasTouch?: boolean;
                                                    /**
                                                    * Specifies if viewport is in landscape mode.
                                                    * @default false
                                                    */
                                                    isLandscape?: boolean;
                                                    } | null;
                                                    • Sets a consistent viewport for each page. Defaults to an 800x600 viewport. null disables the default viewport.

                                                    property ignoreHTTPSErrors

                                                    ignoreHTTPSErrors?: boolean;
                                                    • Whether to ignore HTTPS errors during navigation. false

                                                    property slowMo

                                                    slowMo?: number;
                                                    • Slows down Puppeteer operations by the specified amount of milliseconds. Useful so that you can see what is going on.

                                                    interface CDPSession

                                                    interface CDPSession extends EventEmitter {}

                                                      method detach

                                                      detach: () => Promise<void>;
                                                      • Detaches session from target. Once detached, session won't emit any events and can't be used to send messages.

                                                      method send

                                                      send: (method: string, params?: object) => Promise<object>;
                                                      • Parameter method

                                                        Protocol method name

                                                      interface ChromeArgOptions

                                                      interface ChromeArgOptions {}

                                                        property args

                                                        args?: string[];
                                                        • Additional arguments to pass to the browser instance. The list of Chromium flags can be found here.

                                                        property devtools

                                                        devtools?: boolean;
                                                        • Whether to auto-open a DevTools panel for each tab. If this option is true, the headless option will be set false.

                                                        property headless

                                                        headless?: boolean;
                                                        • Whether to run browser in headless mode. true unless the devtools option is true.

                                                        property userDataDir

                                                        userDataDir?: string;
                                                        • Path to a User Data Directory.

                                                        interface ClickOptions

                                                        interface ClickOptions {}

                                                          property button

                                                          button?: MouseButtons;
                                                          • MouseButtons.Left

                                                          property clickCount

                                                          clickCount?: number;
                                                          • 1

                                                          property delay

                                                          delay?: number;
                                                          • Time to wait between mousedown and mouseup in milliseconds. 0

                                                          interface ConnectionTransport

                                                          interface ConnectionTransport {}

                                                            method close

                                                            close: () => void;

                                                              method onclose

                                                              onclose: () => void;

                                                                method onmessage

                                                                onmessage: (message: string) => void;

                                                                  method send

                                                                  send: (message: string) => void;

                                                                    interface ConnectOptions

                                                                    interface ConnectOptions extends BrowserOptions {}

                                                                      property browserURL

                                                                      browserURL?: string;
                                                                      • A browser url to connect to, in format http://${host}:${port}. Use interchangeably with browserWSEndpoint to let Puppeteer fetch it from metadata endpoint.

                                                                      property browserWSEndpoint

                                                                      browserWSEndpoint?: string;
                                                                      • A browser websocket endpoint to connect to.

                                                                      property transport

                                                                      transport?: ConnectionTransport;
                                                                      • **Experimental** Specify a custom transport object for Puppeteer to use.

                                                                      interface ConsoleMessage

                                                                      interface ConsoleMessage {}
                                                                      • ConsoleMessage objects are dispatched by page via the 'console' event.

                                                                      method args

                                                                      args: () => JSHandle[];
                                                                      • The message arguments.

                                                                      method location

                                                                      location: () => ConsoleMessageLocation;
                                                                      • The location the message originated from

                                                                      method text

                                                                      text: () => string;
                                                                      • The message text.

                                                                      method type

                                                                      type: () => ConsoleMessageType;

                                                                        interface ConsoleMessageLocation

                                                                        interface ConsoleMessageLocation {}

                                                                          property columnNumber

                                                                          columnNumber?: number;
                                                                          • Column number in the resource if known.

                                                                          property lineNumber

                                                                          lineNumber?: number;
                                                                          • Line number in the resource if known

                                                                          property url

                                                                          url?: string;
                                                                          • URL of the resource if known.

                                                                          interface Cookie {}
                                                                          • Represents a browser cookie.

                                                                          property domain

                                                                          domain: string;
                                                                          • The cookie domain.

                                                                          property expires

                                                                          expires: number;
                                                                          • The cookie Unix expiration time in seconds.

                                                                          property httpOnly

                                                                          httpOnly: boolean;
                                                                          • The cookie http only flag.

                                                                          property name

                                                                          name: string;
                                                                          • The cookie name.

                                                                          property path

                                                                          path: string;
                                                                          • The cookie path.

                                                                          property sameSite

                                                                          sameSite: SameSiteSetting;
                                                                          • The cookie same site definition.

                                                                          property secure

                                                                          secure: boolean;
                                                                          • The cookie secure flag.

                                                                          property session

                                                                          session: boolean;
                                                                          • The session cookie flag.

                                                                          property size

                                                                          size: number;
                                                                          • The cookie size

                                                                          property value

                                                                          value: string;
                                                                          • The cookie value.

                                                                          interface Coverage

                                                                          interface Coverage {}

                                                                            method startCSSCoverage

                                                                            startCSSCoverage: (options?: StartCoverageOptions) => Promise<void>;

                                                                              method startJSCoverage

                                                                              startJSCoverage: (options?: StartCoverageOptions) => Promise<void>;

                                                                                method stopCSSCoverage

                                                                                stopCSSCoverage: () => Promise<CoverageEntry[]>;

                                                                                  method stopJSCoverage

                                                                                  stopJSCoverage: () => Promise<CoverageEntry[]>;

                                                                                    interface CoverageEntry

                                                                                    interface CoverageEntry {}

                                                                                      property ranges

                                                                                      ranges: Array<{ start: number; end: number }>;

                                                                                        property text

                                                                                        text: string;

                                                                                          property url

                                                                                          url: string;

                                                                                            interface CustomQueryHandler

                                                                                            interface CustomQueryHandler {}
                                                                                            • Contains two functions queryOne and queryAll that can be registered as alternative querying strategies. The functions queryOne and queryAll are executed in the page context. queryOne should take an Element and a selector string as argument and return a single Element or null if no element is found. queryAll takes the same arguments but should instead return a NodeListOf<Element> or Array<Element> with all the elements that match the given query selector.

                                                                                            property queryAll

                                                                                            queryAll?: (
                                                                                            element: Element | Document,
                                                                                            selector: string
                                                                                            ) => Element[] | NodeListOf<Element>;

                                                                                              property queryOne

                                                                                              queryOne?: (element: Element | Document, selector: string) => Element | null;

                                                                                                interface DeleteCookie

                                                                                                interface DeleteCookie {}

                                                                                                  property domain

                                                                                                  domain?: string;

                                                                                                    property name

                                                                                                    name: string;
                                                                                                    • The cookie name.

                                                                                                    property path

                                                                                                    path?: string;

                                                                                                      property url

                                                                                                      url?: string;

                                                                                                        interface Dialog

                                                                                                        interface Dialog {}
                                                                                                        • Dialog objects are dispatched by page via the 'dialog' event.

                                                                                                        method accept

                                                                                                        accept: (promptText?: string) => Promise<void>;
                                                                                                        • Accepts the dialog.

                                                                                                          Parameter promptText

                                                                                                          A text to enter in prompt. Does not cause any effects if the dialog's type is not prompt.

                                                                                                        method defaultValue

                                                                                                        defaultValue: () => string;
                                                                                                        • If dialog is prompt, returns default prompt value. Otherwise, returns empty string.

                                                                                                        method dismiss

                                                                                                        dismiss: () => Promise<void>;
                                                                                                        • Dismiss the dialog

                                                                                                        method message

                                                                                                        message: () => string;
                                                                                                        • Returns the message displayed in the dialog.

                                                                                                        method type

                                                                                                        type: () => DialogType;
                                                                                                        • The dialog type. Dialog's type, can be one of alert, beforeunload, confirm or prompt.

                                                                                                        interface DirectNavigationOptions

                                                                                                        interface DirectNavigationOptions extends NavigationOptions {}
                                                                                                        • Navigation options for page.goto.

                                                                                                        property referer

                                                                                                        referer?: string;
                                                                                                        • Referer header value. If provided it will take preference over the referer header value set by [page.setExtraHTTPHeaders()](#pagesetextrahttpheadersheaders).

                                                                                                        interface ElementHandle

                                                                                                        interface ElementHandle<E extends Element = Element> extends JSHandle<E>, Evalable {}
                                                                                                        • Represents an in-page DOM element. ElementHandles can be created with the page.$ method.

                                                                                                        method $

                                                                                                        $: (selector: string) => Promise<ElementHandle | null>;
                                                                                                        • The method runs element.querySelector within the page. If no element matches the selector, the return value resolve to null.

                                                                                                          Parameter selector

                                                                                                          A selector to query element for 0.13.0

                                                                                                        method $$

                                                                                                        $$: (selector: string) => Promise<ElementHandle[]>;
                                                                                                        • The method runs element.querySelectorAll within the page. If no elements match the selector, the return value resolve to [].

                                                                                                          Parameter selector

                                                                                                          A selector to query element for 0.13.0

                                                                                                        method $x

                                                                                                        $x: (expression: string) => Promise<ElementHandle[]>;
                                                                                                        • Parameter selector

                                                                                                          XPath expression to evaluate.

                                                                                                        method boundingBox

                                                                                                        boundingBox: () => Promise<BoundingBox | null>;
                                                                                                        • This method returns the value resolve to the bounding box of the element (relative to the main frame), or null if the element is not visible.

                                                                                                        method boxModel

                                                                                                        boxModel: () => Promise<BoxModel | null>;
                                                                                                        • This method returns boxes of the element, or null if the element is not visible. Boxes are represented as an array of points; each Point is an object {x, y}. Box points are sorted clock-wise.

                                                                                                        method click

                                                                                                        click: (options?: ClickOptions) => Promise<void>;
                                                                                                        • This method scrolls element into view if needed, and then uses page.mouse to click in the center of the element. If the element is detached from DOM, the method throws an error.

                                                                                                          Parameter options

                                                                                                          Specifies the options. 0.9.0

                                                                                                        method contentFrame

                                                                                                        contentFrame: () => Promise<Frame | null>;
                                                                                                        • Returns

                                                                                                          Resolves to the content frame for element handles referencing iframe nodes, or null otherwise. 1.2.0

                                                                                                        method focus

                                                                                                        focus: () => Promise<void>;
                                                                                                        • Calls focus on the element.

                                                                                                        method hover

                                                                                                        hover: () => Promise<void>;
                                                                                                        • This method scrolls element into view if needed, and then uses page.mouse to hover over the center of the element. If the element is detached from DOM, the method throws an error.

                                                                                                        method isIntersectingViewport

                                                                                                        isIntersectingViewport: () => Promise<boolean>;
                                                                                                        • Resolves to true if the element is visible in the current viewport.

                                                                                                        method press

                                                                                                        press: (
                                                                                                        key: string,
                                                                                                        options?: { text?: string; delay?: number }
                                                                                                        ) => Promise<void>;
                                                                                                        • Focuses the element, and then uses keyboard.down and keyboard.up.

                                                                                                          Parameter key

                                                                                                          Name of key to press, such as ArrowLeft. See USKeyboardLayout for a list of all key names.

                                                                                                          Parameter options

                                                                                                          The text and delay options.

                                                                                                        method screenshot

                                                                                                        screenshot: {
                                                                                                        (options?: Base64ScreenShotOptions): Promise<string>;
                                                                                                        (options?: BinaryScreenShotOptions): Promise<any>;
                                                                                                        (options?: ScreenshotOptions): Promise<any>;
                                                                                                        };
                                                                                                        • This method scrolls element into view if needed, and then uses page.screenshot to take a screenshot of the element. If the element is detached from DOM, the method throws an error.

                                                                                                          Parameter options

                                                                                                          Same options as in page.screenshot.

                                                                                                        method select

                                                                                                        select: (...values: string[]) => Promise<string[]>;
                                                                                                        • Triggers a change and input event once all the provided options have been selected. If there's no element matching selector, the method throws an error.

                                                                                                          Parameter values

                                                                                                          Values of options to select. If the has the multiple attribute, all values are considered, otherwise only the first one is taken into account.

                                                                                                          Returns

                                                                                                          An array of option values that have been successfully selected. 1.12.0

                                                                                                        method tap

                                                                                                        tap: () => Promise<void>;
                                                                                                        • This method scrolls element into view if needed, and then uses touchscreen.tap to tap in the center of the element. If the element is detached from DOM, the method throws an error.

                                                                                                        method toString

                                                                                                        toString: () => string;

                                                                                                          method type

                                                                                                          type: (text: string, options?: { delay: number }) => Promise<void>;
                                                                                                          • Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.

                                                                                                            Parameter text

                                                                                                            A text to type into a focused element.

                                                                                                            Parameter options

                                                                                                            The typing options.

                                                                                                          method uploadFile

                                                                                                          uploadFile: (...filePaths: string[]) => Promise<void>;
                                                                                                          • This method expects elementHandle to point to an input element.

                                                                                                            Parameter filePaths

                                                                                                            Sets the value of the file input these paths. If some of the filePaths are relative paths, then they are resolved relative to current working directory.

                                                                                                          interface EmulateOptions

                                                                                                          interface EmulateOptions {}
                                                                                                          • Page emulation options.

                                                                                                          property userAgent

                                                                                                          userAgent: string;
                                                                                                          • The emulated user-agent.

                                                                                                          property viewport

                                                                                                          viewport: Viewport;
                                                                                                          • The viewport emulation options.

                                                                                                          interface Evalable

                                                                                                          interface Evalable {}
                                                                                                          • Defines $eval and $$eval for Page, Frame and ElementHandle.

                                                                                                          method $$eval

                                                                                                          $$eval: {
                                                                                                          <R>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (elements: Element[]) => R | Promise<R>
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R, X1>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (
                                                                                                          elements: Element[],
                                                                                                          x1: UnwrapElementHandle<X1>
                                                                                                          ) => R | Promise<R>,
                                                                                                          x1: X1
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R, X1, X2>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (
                                                                                                          elements: Element[],
                                                                                                          x1: UnwrapElementHandle<X1>,
                                                                                                          x2: UnwrapElementHandle<X2>
                                                                                                          ) => R | Promise<R>,
                                                                                                          x1: X1,
                                                                                                          x2: X2
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R, X1, X2, X3>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (
                                                                                                          elements: Element[],
                                                                                                          x1: UnwrapElementHandle<X1>,
                                                                                                          x2: UnwrapElementHandle<X2>,
                                                                                                          x3: UnwrapElementHandle<X3>
                                                                                                          ) => R | Promise<R>,
                                                                                                          x1: X1,
                                                                                                          x2: X2,
                                                                                                          x3: X3
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (elements: Element[], ...args: any[]) => R | Promise<R>,
                                                                                                          ...args: SerializableOrJSHandle[]
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          };
                                                                                                          • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

                                                                                                            If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

                                                                                                            If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter x1

                                                                                                            First argument to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

                                                                                                            If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter x1

                                                                                                            First argument to pass to pageFunction

                                                                                                            Parameter x2

                                                                                                            Second argument to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

                                                                                                            If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter x1

                                                                                                            First argument to pass to pageFunction

                                                                                                            Parameter x2

                                                                                                            Second argument to pass to pageFunction

                                                                                                            Parameter x3

                                                                                                            Third argument to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs Array.from(document.querySelectorAll(selector)) within the context and passes it as the first argument to pageFunction.

                                                                                                            If pageFunction returns a Promise, then $$eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter args

                                                                                                            Arguments to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          method $eval

                                                                                                          $eval: {
                                                                                                          <R>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (element: Element) => R | Promise<R>
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R, X1>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (
                                                                                                          element: Element,
                                                                                                          x1: UnwrapElementHandle<X1>
                                                                                                          ) => R | Promise<R>,
                                                                                                          x1: X1
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R, X1, X2>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (
                                                                                                          element: Element,
                                                                                                          x1: UnwrapElementHandle<X1>,
                                                                                                          x2: UnwrapElementHandle<X2>
                                                                                                          ) => R | Promise<R>,
                                                                                                          x1: X1,
                                                                                                          x2: X2
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R, X1, X2, X3>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (
                                                                                                          element: Element,
                                                                                                          x1: UnwrapElementHandle<X1>,
                                                                                                          x2: UnwrapElementHandle<X2>,
                                                                                                          x3: UnwrapElementHandle<X3>
                                                                                                          ) => R | Promise<R>,
                                                                                                          x1: X1,
                                                                                                          x2: X2,
                                                                                                          x3: X3
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          <R>(
                                                                                                          selector: string,
                                                                                                          pageFunction: (element: Element, ...args: any[]) => R | Promise<R>,
                                                                                                          ...args: SerializableOrJSHandle[]
                                                                                                          ): Promise<WrapElementHandle<R>>;
                                                                                                          };
                                                                                                          • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

                                                                                                            If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

                                                                                                            If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter x1

                                                                                                            First argument to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

                                                                                                            If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter x1

                                                                                                            First argument to pass to pageFunction

                                                                                                            Parameter x2

                                                                                                            Second argument to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

                                                                                                            If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter x1

                                                                                                            First argument to pass to pageFunction

                                                                                                            Parameter x2

                                                                                                            Second argument to pass to pageFunction

                                                                                                            Parameter x3

                                                                                                            Third argument to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          • This method runs document.querySelector within the context and passes it as the first argument to pageFunction. If there's no element matching selector, the method throws an error.

                                                                                                            If pageFunction returns a Promise, then $eval would wait for the promise to resolve and return its value.

                                                                                                            Parameter selector

                                                                                                            A selector to query for

                                                                                                            Parameter pageFunction

                                                                                                            Function to be evaluated in browser context

                                                                                                            Parameter args

                                                                                                            Arguments to pass to pageFunction

                                                                                                            Returns

                                                                                                            Promise which resolves to the return value of pageFunction

                                                                                                          interface EventEmitter

                                                                                                          interface EventEmitter {}

                                                                                                            method addListener

                                                                                                            addListener: (event: EventType, handler: Handler) => EventEmitter;

                                                                                                              method emit

                                                                                                              emit: (event: EventType, eventData?: any) => boolean;

                                                                                                                method listenerCount

                                                                                                                listenerCount: (event: string) => number;

                                                                                                                  method off

                                                                                                                  off: (event: EventType, handler: Handler) => EventEmitter;

                                                                                                                    method on

                                                                                                                    on: (event: EventType, handler: Handler) => EventEmitter;

                                                                                                                      method once

                                                                                                                      once: (event: EventType, handler: Handler) => EventEmitter;

                                                                                                                        method removeAllListeners

                                                                                                                        removeAllListeners: (event?: EventType) => EventEmitter;

                                                                                                                          method removeListener

                                                                                                                          removeListener: (event: EventType, handler: Handler) => EventEmitter;

                                                                                                                            interface ExecutionContext

                                                                                                                            interface ExecutionContext extends JSEvalable {}
                                                                                                                            • The class represents a context for JavaScript execution.

                                                                                                                            method queryObjects

                                                                                                                            queryObjects: (prototypeHandle: JSHandle) => Promise<JSHandle>;

                                                                                                                              interface FetcherOptions

                                                                                                                              interface FetcherOptions {}

                                                                                                                                property host

                                                                                                                                host?: string;
                                                                                                                                • A download host to be used. Defaults to https://storage.googleapis.com.

                                                                                                                                property path

                                                                                                                                path?: string;
                                                                                                                                • A path for the downloads folder. Defaults to <root>/.local-chromium, where <root> is puppeteer's package root.

                                                                                                                                property platform

                                                                                                                                platform?: Platform;
                                                                                                                                • Possible values are: mac, win32, win64, linux. Defaults to the current platform.

                                                                                                                                property product

                                                                                                                                product?: Product;
                                                                                                                                • 'chrome'

                                                                                                                                interface FileChooser

                                                                                                                                interface FileChooser {}

                                                                                                                                  method accept

                                                                                                                                  accept: (filePaths: string[]) => Promise<void>;
                                                                                                                                  • Accept the file chooser request with given paths. If some of the filePaths are relative paths, then they are resolved relative to the current working directory.

                                                                                                                                  method cancel

                                                                                                                                  cancel: () => Promise<void>;
                                                                                                                                  • Closes the file chooser without selecting any files.

                                                                                                                                  method isMultiple

                                                                                                                                  isMultiple: () => boolean;
                                                                                                                                  • Whether file chooser allow for multiple file selection.

                                                                                                                                  interface Frame

                                                                                                                                  interface Frame extends FrameBase {}

                                                                                                                                    method childFrames

                                                                                                                                    childFrames: () => Frame[];

                                                                                                                                      method executionContext

                                                                                                                                      executionContext: () => Promise<ExecutionContext>;
                                                                                                                                      • Execution context associated with this frame.

                                                                                                                                      method isDetached

                                                                                                                                      isDetached: () => boolean;
                                                                                                                                      • Returns true if the frame has been detached, or false otherwise.

                                                                                                                                      method name

                                                                                                                                      name: () => string;
                                                                                                                                      • Returns frame's name attribute as specified in the tag.

                                                                                                                                      method parentFrame

                                                                                                                                      parentFrame: () => Frame | null;
                                                                                                                                      • Returns parent frame, if any. Detached frames and main frames return null.

                                                                                                                                      interface FrameBase

                                                                                                                                      interface FrameBase extends Evalable, JSEvalable {}

                                                                                                                                        method $

                                                                                                                                        $: (selector: string) => Promise<ElementHandle | null>;
                                                                                                                                        • The method queries frame for the selector. If there's no such element within the frame, the method will resolve to null.

                                                                                                                                        method $$

                                                                                                                                        $$: (selector: string) => Promise<ElementHandle[]>;
                                                                                                                                        • The method runs document.querySelectorAll within the frame. If no elements match the selector, the return value resolve to [].

                                                                                                                                        method $x

                                                                                                                                        $x: (expression: string) => Promise<ElementHandle[]>;
                                                                                                                                        • The method evaluates the XPath expression.

                                                                                                                                          Parameter expression

                                                                                                                                          XPath expression to evaluate.

                                                                                                                                        method addScriptTag

                                                                                                                                        addScriptTag: (options: ScriptTagOptions) => Promise<void>;
                                                                                                                                        • Adds a <script> tag into the page with the desired url or content.

                                                                                                                                        method addStyleTag

                                                                                                                                        addStyleTag: (options: StyleTagOptions) => Promise<void>;
                                                                                                                                        • Adds a <link rel="stylesheet"> tag into the page with the desired url or a <style type="text/css"> tag with the content.

                                                                                                                                        method click

                                                                                                                                        click: (selector: string, options?: ClickOptions) => Promise<void>;
                                                                                                                                        • This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to click in the center of the element. If there's no element matching selector, the method throws an error.

                                                                                                                                          Parameter selector

                                                                                                                                          A selector to search for element to click. If there are multiple elements satisfying the selector, the first will be clicked.

                                                                                                                                          Parameter options

                                                                                                                                          Specifies the click options.

                                                                                                                                        method content

                                                                                                                                        content: () => Promise<string>;
                                                                                                                                        • Gets the full HTML contents of the page, including the doctype.

                                                                                                                                        method focus

                                                                                                                                        focus: (selector: string) => Promise<void>;
                                                                                                                                        • This method fetches an element with selector and focuses it.

                                                                                                                                        method goto

                                                                                                                                        goto: (
                                                                                                                                        url: string,
                                                                                                                                        options?: DirectNavigationOptions
                                                                                                                                        ) => Promise<Response | null>;
                                                                                                                                        • Navigates to a URL.

                                                                                                                                          Parameter url

                                                                                                                                          URL to navigate page to. The url should include scheme, e.g. https://

                                                                                                                                          Parameter options

                                                                                                                                          The navigation parameters.

                                                                                                                                        method hover

                                                                                                                                        hover: (selector: string) => Promise<void>;
                                                                                                                                        • This method fetches an element with selector, scrolls it into view if needed, and then uses page.mouse to hover over the center of the element. If there's no element matching selector, the method throws an error.

                                                                                                                                          Parameter selector

                                                                                                                                          A selector to search for element to hover. If there are multiple elements satisfying the selector, the first will be hovered.

                                                                                                                                        method select

                                                                                                                                        select: (selector: string, ...values: string[]) => Promise<string[]>;
                                                                                                                                        • Triggers a change and input event once all the provided options have been selected. If there's no <select> element matching selector, the method throws an error.

                                                                                                                                          Parameter selector

                                                                                                                                          A selector to query page for.

                                                                                                                                          Parameter values

                                                                                                                                          Values of options to select. If the <select> has the multiple attribute, all values are considered, otherwise only the first one is taken into account.

                                                                                                                                        method setContent

                                                                                                                                        setContent: (html: string, options?: NavigationOptions) => Promise<void>;
                                                                                                                                        • Sets the page content.

                                                                                                                                          Parameter html

                                                                                                                                          HTML markup to assign to the page.

                                                                                                                                          Parameter options

                                                                                                                                          The navigation parameters.

                                                                                                                                        method tap

                                                                                                                                        tap: (selector: string) => Promise<void>;
                                                                                                                                        • This method fetches an element with selector, scrolls it into view if needed, and then uses page.touchscreen to tap in the center of the element.

                                                                                                                                          Parameter selector

                                                                                                                                          A selector to search for element to tap. If there are multiple elements satisfying the selector, the first will be tapped.

                                                                                                                                        method title

                                                                                                                                        title: () => Promise<string>;
                                                                                                                                        • Returns page's title.

                                                                                                                                        method type

                                                                                                                                        type: (
                                                                                                                                        selector: string,
                                                                                                                                        text: string,
                                                                                                                                        options?: { delay: number }
                                                                                                                                        ) => Promise<void>;
                                                                                                                                        • Sends a keydown, keypress/input, and keyup event for each character in the text.

                                                                                                                                          Parameter selector

                                                                                                                                          A selector of an element to type into. If there are multiple elements satisfying the selector, the first will be used.

                                                                                                                                          Parameter text

                                                                                                                                          : A text to type into a focused element.

                                                                                                                                          Parameter options

                                                                                                                                          : The typing parameters.

                                                                                                                                        method url

                                                                                                                                        url: () => string;
                                                                                                                                        • Returns frame's url.

                                                                                                                                        method waitFor

                                                                                                                                        waitFor: {
                                                                                                                                        (duration: number): Promise<void>;
                                                                                                                                        (selector: string, options: WaitForSelectorOptionsHidden): Promise<
                                                                                                                                        ElementHandle<Element>
                                                                                                                                        >;
                                                                                                                                        (selector: string, options?: WaitForSelectorOptions): Promise<
                                                                                                                                        ElementHandle<Element>
                                                                                                                                        >;
                                                                                                                                        (
                                                                                                                                        selector: EvaluateFn<any>,
                                                                                                                                        options?: WaitForSelectorOptions,
                                                                                                                                        ...args: SerializableOrJSHandle[]
                                                                                                                                        ): Promise<JSHandle<any>>;
                                                                                                                                        };
                                                                                                                                        • Parameter selectorOrFunctionOrTimeout

                                                                                                                                          a selector, predicate or timeout to wait for.

                                                                                                                                          Parameter options

                                                                                                                                          optional waiting parameters.

                                                                                                                                          Parameter args

                                                                                                                                          arguments to pass to pageFunction.

                                                                                                                                          Remarks

                                                                                                                                          This method behaves differently depending on the first parameter. If it's a string, it will be treated as a selector or xpath (if the string starts with //). This method then is a shortcut for Frame.waitForSelector or Frame.waitForXPath.

                                                                                                                                          If the first argument is a function this method is a shortcut for Frame.waitForFunction.

                                                                                                                                          If the first argument is a number, it's treated as a timeout in milliseconds and the method returns a promise which resolves after the timeout.

                                                                                                                                          Deprecated

                                                                                                                                          Don't use this method directly. Instead use the more explicit methods available: Frame.waitForSelector, Frame.waitForXPath, Frame.waitForFunction or Frame.waitForTimeout.

                                                                                                                                        method waitForFunction

                                                                                                                                        waitForFunction: (
                                                                                                                                        fn: EvaluateFn,
                                                                                                                                        options?: PageFnOptions,
                                                                                                                                        ...args: SerializableOrJSHandle[]
                                                                                                                                        ) => Promise<JSHandle>;
                                                                                                                                        • Allows waiting for various conditions.

                                                                                                                                        method waitForNavigation

                                                                                                                                        waitForNavigation: (options?: NavigationOptions) => Promise<Response>;
                                                                                                                                        • Wait for the page navigation occur.

                                                                                                                                          Parameter options

                                                                                                                                          The navigation parameters.

                                                                                                                                        method waitForSelector

                                                                                                                                        waitForSelector: {
                                                                                                                                        (selector: string, options?: WaitForSelectorOptions): Promise<ElementHandle>;
                                                                                                                                        (selector: string, options?: WaitForSelectorOptionsHidden): Promise<
                                                                                                                                        ElementHandle<Element>
                                                                                                                                        >;
                                                                                                                                        };

                                                                                                                                          method waitForTimeout

                                                                                                                                          waitForTimeout: (milliseconds: number) => Promise<void>;
                                                                                                                                          • Causes your script to wait for the given number of milliseconds.

                                                                                                                                            Parameter milliseconds

                                                                                                                                            the number of milliseconds to wait.

                                                                                                                                            Remarks

                                                                                                                                            It's generally recommended to not wait for a number of seconds, but instead use Frame.waitForSelector, Frame.waitForXPath or Frame.waitForFunction to wait for exactly the conditions you want.

                                                                                                                                            Example 1

                                                                                                                                            Wait for 1 second:

                                                                                                                                            await frame.waitForTimeout(1000);

                                                                                                                                          method waitForXPath

                                                                                                                                          waitForXPath: (
                                                                                                                                          xpath: string,
                                                                                                                                          options?: WaitForSelectorOptions
                                                                                                                                          ) => Promise<ElementHandle>;

                                                                                                                                            interface GeoOptions

                                                                                                                                            interface GeoOptions {}

                                                                                                                                              property accuracy

                                                                                                                                              accuracy?: number;
                                                                                                                                              • Non-negative accuracy value.

                                                                                                                                              property latitude

                                                                                                                                              latitude: number;
                                                                                                                                              • Latitude between -90 and 90.

                                                                                                                                              property longitude

                                                                                                                                              longitude: number;
                                                                                                                                              • Longitude between -180 and 180.

                                                                                                                                              interface JSEvalable

                                                                                                                                              interface JSEvalable<A = any> {}

                                                                                                                                                method evaluate

                                                                                                                                                evaluate: <T extends EvaluateFn<A>>(
                                                                                                                                                pageFunction: T,
                                                                                                                                                ...args: SerializableOrJSHandle[]
                                                                                                                                                ) => Promise<
                                                                                                                                                EvaluateFnReturnType<T> extends PromiseLike<infer U>
                                                                                                                                                ? U
                                                                                                                                                : EvaluateFnReturnType<T>
                                                                                                                                                >;
                                                                                                                                                • Evaluates a function in the browser context. If the function, passed to the frame.evaluate, returns a Promise, then frame.evaluate would wait for the promise to resolve and return its value. If the function passed into frame.evaluate returns a non-Serializable value, then frame.evaluate resolves to undefined.

                                                                                                                                                  Parameter fn

                                                                                                                                                  Function to be evaluated in browser context

                                                                                                                                                  Parameter args

                                                                                                                                                  Arguments to pass to fn

                                                                                                                                                method evaluateHandle

                                                                                                                                                evaluateHandle: <HandlerType extends JSHandle<any> = JSHandle<any>>(
                                                                                                                                                pageFunction: string | ((arg1: A, ...args: any[]) => any),
                                                                                                                                                ...args: SerializableOrJSHandle[]
                                                                                                                                                ) => Promise<HandlerType>;
                                                                                                                                                • The only difference between evaluate and evaluateHandle is that evaluateHandle returns in-page object (JSHandle). If the function, passed to the evaluateHandle, returns a Promise, then evaluateHandle would wait for the promise to resolve and return its value. The TypeScript definitions assume that evaluateHandle returns a JSHandle, but if you know it's going to return an ElementHandle, pass it as the generic argument:

                                                                                                                                                  Parameter pageFunction

                                                                                                                                                  a function that is run within the page

                                                                                                                                                  Parameter args

                                                                                                                                                  arguments to be passed to the pageFunction

                                                                                                                                                interface JSHandle

                                                                                                                                                interface JSHandle<T = any> extends JSEvalable<T> {}
                                                                                                                                                • JSHandle represents an in-page JavaScript object.

                                                                                                                                                method asElement

                                                                                                                                                asElement: () => ElementHandle | null;
                                                                                                                                                • Returns a ElementHandle

                                                                                                                                                method dispose

                                                                                                                                                dispose: () => Promise<void>;
                                                                                                                                                • Stops referencing the element handle.

                                                                                                                                                method executionContext

                                                                                                                                                executionContext: () => ExecutionContext;
                                                                                                                                                • Gets the execution context.

                                                                                                                                                method getProperties

                                                                                                                                                getProperties: () => Promise<Map<string, JSHandle>>;
                                                                                                                                                • Returns a map with property names as keys and JSHandle instances for the property values.

                                                                                                                                                method getProperty

                                                                                                                                                getProperty: (propertyName: string) => Promise<JSHandle>;
                                                                                                                                                • Fetches a single property from the objectHandle.

                                                                                                                                                  Parameter propertyName

                                                                                                                                                  The property to get.

                                                                                                                                                method jsonValue

                                                                                                                                                jsonValue: () => Promise<unknown>;
                                                                                                                                                • Returns a JSON representation of the object. The JSON is generated by running JSON.stringify on the object in page and consequent JSON.parse in puppeteer.

                                                                                                                                                  Throws

                                                                                                                                                  The method will throw if the referenced object is not stringifiable.

                                                                                                                                                interface JSONArray

                                                                                                                                                interface JSONArray extends Array<Serializable> {}

                                                                                                                                                  interface JSONObject

                                                                                                                                                  interface JSONObject {}

                                                                                                                                                    index signature

                                                                                                                                                    [key: string]: Serializable;

                                                                                                                                                      interface Keyboard

                                                                                                                                                      interface Keyboard {}
                                                                                                                                                      • Keyboard provides an api for managing a virtual keyboard.

                                                                                                                                                      method down

                                                                                                                                                      down: (key: string, options?: { text?: string }) => Promise<void>;
                                                                                                                                                      • Dispatches a keydown event.

                                                                                                                                                        Parameter key

                                                                                                                                                        Name of key to press, such as ArrowLeft.

                                                                                                                                                        Parameter options

                                                                                                                                                        Specifies a input text event.

                                                                                                                                                      method press

                                                                                                                                                      press: (
                                                                                                                                                      key: string,
                                                                                                                                                      options?: { text?: string; delay?: number }
                                                                                                                                                      ) => Promise<void>;
                                                                                                                                                      • Shortcut for keyboard.down and keyboard.up.

                                                                                                                                                      method sendCharacter

                                                                                                                                                      sendCharacter: (char: string) => Promise<void>;
                                                                                                                                                      • Dispatches a keypress and input event. This does not send a keydown or keyup event.

                                                                                                                                                      method type

                                                                                                                                                      type: (text: string, options?: { delay?: number }) => Promise<void>;
                                                                                                                                                      • Sends a keydown, keypress/input, and keyup event for each character in the text.

                                                                                                                                                        Parameter text

                                                                                                                                                        A text to type into a focused element.

                                                                                                                                                        Parameter options

                                                                                                                                                        Specifies the typing options.

                                                                                                                                                      method up

                                                                                                                                                      up: (key: string) => Promise<void>;
                                                                                                                                                      • Dispatches a keyup event.

                                                                                                                                                        Parameter key

                                                                                                                                                        Name of key to release, such as ArrowLeft.

                                                                                                                                                      interface LaunchOptions

                                                                                                                                                      interface LaunchOptions extends ChromeArgOptions, BrowserOptions, Timeoutable {}

                                                                                                                                                        property dumpio

                                                                                                                                                        dumpio?: boolean;
                                                                                                                                                        • Whether to pipe browser process stdout and stderr into process.stdout and process.stderr. false

                                                                                                                                                        property env

                                                                                                                                                        env?: {
                                                                                                                                                        [key: string]: string | boolean | number;
                                                                                                                                                        };
                                                                                                                                                        • Specify environment variables that will be visible to Chromium. process.env.

                                                                                                                                                        property executablePath

                                                                                                                                                        executablePath?: string;
                                                                                                                                                        • Path to a Chromium executable to run instead of bundled Chromium. If executablePath is a relative path, then it is resolved relative to current working directory.

                                                                                                                                                        property handleSIGHUP

                                                                                                                                                        handleSIGHUP?: boolean;
                                                                                                                                                        • Close chrome process on SIGHUP. true

                                                                                                                                                        property handleSIGINT

                                                                                                                                                        handleSIGINT?: boolean;
                                                                                                                                                        • Close chrome process on Ctrl-C. true

                                                                                                                                                        property handleSIGTERM

                                                                                                                                                        handleSIGTERM?: boolean;
                                                                                                                                                        • Close chrome process on SIGTERM. true

                                                                                                                                                        property ignoreDefaultArgs

                                                                                                                                                        ignoreDefaultArgs?: boolean | string[];
                                                                                                                                                        • Do not use puppeteer.defaultArgs() for launching Chromium. false

                                                                                                                                                        property pipe

                                                                                                                                                        pipe?: boolean;
                                                                                                                                                        • Connects to the browser over a pipe instead of a WebSocket. false

                                                                                                                                                        property product

                                                                                                                                                        product?: Product;
                                                                                                                                                        • Which browser to launch. At this time, this is either chrome or firefox. See also PUPPETEER_PRODUCT. 'chrome'

                                                                                                                                                        interface MediaFeature

                                                                                                                                                        interface MediaFeature {}

                                                                                                                                                          property name

                                                                                                                                                          name: string;

                                                                                                                                                            property value

                                                                                                                                                            value: string;

                                                                                                                                                              interface Metrics

                                                                                                                                                              interface Metrics {}

                                                                                                                                                                property Documents

                                                                                                                                                                Documents: number;
                                                                                                                                                                • Number of documents in the page.

                                                                                                                                                                property Frames

                                                                                                                                                                Frames: number;
                                                                                                                                                                • Number of frames in the page.

                                                                                                                                                                property JSEventListeners

                                                                                                                                                                JSEventListeners: number;
                                                                                                                                                                • Number of events in the page.

                                                                                                                                                                property JSHeapTotalSize

                                                                                                                                                                JSHeapTotalSize: number;
                                                                                                                                                                • Total JavaScript heap size.

                                                                                                                                                                property JSHeapUsedSize

                                                                                                                                                                JSHeapUsedSize: number;
                                                                                                                                                                • Used JavaScript heap size.

                                                                                                                                                                property LayoutCount

                                                                                                                                                                LayoutCount: number;
                                                                                                                                                                • Total number of full or partial page layout.

                                                                                                                                                                property LayoutDuration

                                                                                                                                                                LayoutDuration: number;
                                                                                                                                                                • Combined durations of all page layouts.

                                                                                                                                                                property Nodes

                                                                                                                                                                Nodes: number;
                                                                                                                                                                • Number of DOM nodes in the page.

                                                                                                                                                                property RecalcStyleCount

                                                                                                                                                                RecalcStyleCount: number;
                                                                                                                                                                • Total number of page style recalculations.

                                                                                                                                                                property RecalcStyleDuration

                                                                                                                                                                RecalcStyleDuration: number;
                                                                                                                                                                • Combined duration of all page style recalculations.

                                                                                                                                                                property ScriptDuration

                                                                                                                                                                ScriptDuration: number;
                                                                                                                                                                • Combined duration of JavaScript execution.

                                                                                                                                                                property TaskDuration

                                                                                                                                                                TaskDuration: number;
                                                                                                                                                                • Combined duration of all tasks performed by the browser.

                                                                                                                                                                property Timestamp

                                                                                                                                                                Timestamp: number;
                                                                                                                                                                • The timestamp when the metrics sample was taken.

                                                                                                                                                                interface Mouse

                                                                                                                                                                interface Mouse {}

                                                                                                                                                                  method click

                                                                                                                                                                  click: (x: number, y: number, options?: ClickOptions) => Promise<void>;
                                                                                                                                                                  • Shortcut for mouse.move, mouse.down and mouse.up.

                                                                                                                                                                    Parameter x

                                                                                                                                                                    The x position.

                                                                                                                                                                    Parameter y

                                                                                                                                                                    The y position.

                                                                                                                                                                    Parameter options

                                                                                                                                                                    The click options.

                                                                                                                                                                  method down

                                                                                                                                                                  down: (options?: MousePressOptions) => Promise<void>;
                                                                                                                                                                  • Dispatches a mousedown event.

                                                                                                                                                                    Parameter options

                                                                                                                                                                    The mouse press options.

                                                                                                                                                                  method move

                                                                                                                                                                  move: (x: number, y: number, options?: { steps: number }) => Promise<void>;
                                                                                                                                                                  • Dispatches a mousemove event.

                                                                                                                                                                    Parameter x

                                                                                                                                                                    The x position.

                                                                                                                                                                    Parameter y

                                                                                                                                                                    The y position.

                                                                                                                                                                    Parameter options

                                                                                                                                                                    The mouse move options.

                                                                                                                                                                  method up

                                                                                                                                                                  up: (options?: MousePressOptions) => Promise<void>;
                                                                                                                                                                  • Dispatches a mouseup event.

                                                                                                                                                                    Parameter options

                                                                                                                                                                    The mouse press options.

                                                                                                                                                                  method wheel

                                                                                                                                                                  wheel: (options?: MouseWheelOptions) => Promise<void>;
                                                                                                                                                                  • Dispatches a mousewheel event.

                                                                                                                                                                    Parameter options

                                                                                                                                                                    Optional: MouseWheelOptions.

                                                                                                                                                                    Example 1

                                                                                                                                                                    An example of zooming into an element:

                                                                                                                                                                    await page.goto('https://mdn.mozillademos.org/en-US/docs/Web/API/Element/wheel_event$samples/Scaling_an_element_via_the_wheel?revision=1587366');
                                                                                                                                                                    const elem = await page.$('div');
                                                                                                                                                                    const boundingBox = await elem.boundingBox();
                                                                                                                                                                    await page.mouse.move(
                                                                                                                                                                    boundingBox.x + boundingBox.width / 2,
                                                                                                                                                                    boundingBox.y + boundingBox.height / 2
                                                                                                                                                                    );
                                                                                                                                                                    await page.mouse.wheel({ deltaY: -100 })

                                                                                                                                                                  interface MousePressOptions

                                                                                                                                                                  interface MousePressOptions {}

                                                                                                                                                                    property button

                                                                                                                                                                    button?: MouseButtons;
                                                                                                                                                                    • left, right, or middle. left

                                                                                                                                                                    property clickCount

                                                                                                                                                                    clickCount?: number;
                                                                                                                                                                    • The number of clicks. 1

                                                                                                                                                                    interface MouseWheelOptions

                                                                                                                                                                    interface MouseWheelOptions {}

                                                                                                                                                                      property deltaX

                                                                                                                                                                      deltaX?: number;

                                                                                                                                                                        property deltaY

                                                                                                                                                                        deltaY?: number;

                                                                                                                                                                          interface MouseWheelOptions

                                                                                                                                                                          interface MouseWheelOptions {}

                                                                                                                                                                            property deltaX

                                                                                                                                                                            deltaX?: number;
                                                                                                                                                                            • X delta in CSS pixels for mouse wheel event. Positive values emulate a scroll up and negative values a scroll down event. 0

                                                                                                                                                                            property deltaY

                                                                                                                                                                            deltaY?: number;
                                                                                                                                                                            • Y delta in CSS pixels for mouse wheel event. Positive values emulate a scroll right and negative values a scroll left event. 0

                                                                                                                                                                            interface NavigationOptions extends Timeoutable {}
                                                                                                                                                                            • The navigation options.

                                                                                                                                                                            waitUntil?: LoadEvent | LoadEvent[];
                                                                                                                                                                            • When to consider navigation succeeded. load Navigation is consider when the load event is fired.

                                                                                                                                                                            interface Overrides

                                                                                                                                                                            interface Overrides {}

                                                                                                                                                                              property headers

                                                                                                                                                                              headers?: Headers;

                                                                                                                                                                                property method

                                                                                                                                                                                method?: HttpMethod;

                                                                                                                                                                                  property postData

                                                                                                                                                                                  postData?: string;

                                                                                                                                                                                    property url

                                                                                                                                                                                    url?: string;

                                                                                                                                                                                      interface Page

                                                                                                                                                                                      interface Page extends EventEmitter, FrameBase {}
                                                                                                                                                                                      • Page provides methods to interact with a single tab in Chromium. One Browser instance might have multiple Page instances.

                                                                                                                                                                                      property accessibility

                                                                                                                                                                                      accessibility: Accessibility;

                                                                                                                                                                                        property coverage

                                                                                                                                                                                        coverage: Coverage;

                                                                                                                                                                                          property keyboard

                                                                                                                                                                                          keyboard: Keyboard;
                                                                                                                                                                                          • Returns the virtual keyboard.

                                                                                                                                                                                          property mouse

                                                                                                                                                                                          mouse: Mouse;
                                                                                                                                                                                          • Gets the virtual mouse.

                                                                                                                                                                                          property touchscreen

                                                                                                                                                                                          touchscreen: Touchscreen;
                                                                                                                                                                                          • Returns the virtual touchscreen object.

                                                                                                                                                                                          property tracing

                                                                                                                                                                                          tracing: Tracing;
                                                                                                                                                                                          • Returns the tracing object.

                                                                                                                                                                                          method authenticate

                                                                                                                                                                                          authenticate: (credentials: AuthOptions | null) => Promise<void>;
                                                                                                                                                                                          • Provide credentials for http authentication. To disable authentication, pass null.

                                                                                                                                                                                          method bringToFront

                                                                                                                                                                                          bringToFront: () => Promise<void>;
                                                                                                                                                                                          • Brings page to front (activates tab).

                                                                                                                                                                                          method browser

                                                                                                                                                                                          browser: () => Browser;
                                                                                                                                                                                          • Get the browser the page belongs to.

                                                                                                                                                                                          method browserContext

                                                                                                                                                                                          browserContext: () => BrowserContext;
                                                                                                                                                                                          • Get the browser context that the page belongs to.

                                                                                                                                                                                          method close

                                                                                                                                                                                          close: (options?: PageCloseOptions) => Promise<void>;
                                                                                                                                                                                          • Closes the current page.

                                                                                                                                                                                          method cookies

                                                                                                                                                                                          cookies: (...urls: string[]) => Promise<Cookie[]>;
                                                                                                                                                                                          • Gets the cookies. If no URLs are specified, this method returns cookies for the current page URL. If URLs are specified, only cookies for those URLs are returned.

                                                                                                                                                                                          method deleteCookie

                                                                                                                                                                                          deleteCookie: (...cookies: DeleteCookie[]) => Promise<void>;
                                                                                                                                                                                          • Deletes the specified cookies.

                                                                                                                                                                                          method emulate

                                                                                                                                                                                          emulate: (options: EmulateOptions) => Promise<void>;
                                                                                                                                                                                          • Emulates given device metrics and user agent. This method is a shortcut for setUserAgent and setViewport.

                                                                                                                                                                                          method emulateIdleState

                                                                                                                                                                                          emulateIdleState: (overrides?: {
                                                                                                                                                                                          isUserActive: boolean;
                                                                                                                                                                                          isScreenUnlocked: boolean;
                                                                                                                                                                                          }) => Promise<void>;
                                                                                                                                                                                          • Emulates the idle state. If no arguments set, clears idle state emulation.

                                                                                                                                                                                            Parameter overrides

                                                                                                                                                                                            Mock idle state. If not set, clears idle overrides

                                                                                                                                                                                            Parameter isUserActive

                                                                                                                                                                                            Mock isUserActive

                                                                                                                                                                                            Parameter isScreenUnlocked

                                                                                                                                                                                            Mock isScreenUnlocked

                                                                                                                                                                                            Example 1

                                                                                                                                                                                            // set idle emulation
                                                                                                                                                                                            await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
                                                                                                                                                                                            // do some checks here
                                                                                                                                                                                            ...
                                                                                                                                                                                            // clear idle emulation
                                                                                                                                                                                            await page.emulateIdleState();

                                                                                                                                                                                          method emulateMediaFeatures

                                                                                                                                                                                          emulateMediaFeatures: (features: MediaFeature[] | null) => Promise<void>;
                                                                                                                                                                                          • Given an array of media feature objects, emulates CSS media features on the page. Passing null resets all.

                                                                                                                                                                                          method emulateMediaType

                                                                                                                                                                                          emulateMediaType: (mediaType: MediaType | null) => Promise<void>;
                                                                                                                                                                                          • Emulates the media.

                                                                                                                                                                                          method emulateTimezone

                                                                                                                                                                                          emulateTimezone: (tz: string | null) => Promise<void>;
                                                                                                                                                                                          • Changes the timezone of the page. See ICU’s [metaZones.txt](https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt?rcl=faee8bc70570192d82d2978a71e2a615788597d1) for a list of supported timezone IDs. Passing null disables timezone emulation.

                                                                                                                                                                                          method evaluateOnNewDocument

                                                                                                                                                                                          evaluateOnNewDocument: (
                                                                                                                                                                                          fn: EvaluateFn,
                                                                                                                                                                                          ...args: SerializableOrJSHandle[]
                                                                                                                                                                                          ) => Promise<void>;
                                                                                                                                                                                          • Adds a function which would be invoked in one of the following scenarios: whenever the page is navigated; whenever the child frame is attached or navigated. The function is invoked after the document was created but before any of its scripts were run. This is useful to amend JavaScript environment, e.g. to seed Math.random.

                                                                                                                                                                                            Parameter fn

                                                                                                                                                                                            The function to be evaluated in browser context.

                                                                                                                                                                                            Parameter args

                                                                                                                                                                                            The arguments to pass to the fn.

                                                                                                                                                                                          method exposeFunction

                                                                                                                                                                                          exposeFunction: (
                                                                                                                                                                                          name: string,
                                                                                                                                                                                          puppeteerFunction: (...args: any[]) => any
                                                                                                                                                                                          ) => Promise<void>;
                                                                                                                                                                                          • The method adds a function called name on the page's window object. When called, the function executes puppeteerFunction in node.js and returns a Promise which resolves to the return value of puppeteerFunction.

                                                                                                                                                                                            Parameter name

                                                                                                                                                                                            The name of the function on the window object.

                                                                                                                                                                                            Parameter fn

                                                                                                                                                                                            Callback function which will be called in Puppeteer's context.

                                                                                                                                                                                          method frames

                                                                                                                                                                                          frames: () => Frame[];
                                                                                                                                                                                          • An array of all frames attached to the page.

                                                                                                                                                                                          method goBack

                                                                                                                                                                                          goBack: (options?: NavigationOptions) => Promise<Response | null>;
                                                                                                                                                                                          • Navigate to the previous page in history.

                                                                                                                                                                                            Parameter options

                                                                                                                                                                                            The navigation parameters.

                                                                                                                                                                                          method goForward

                                                                                                                                                                                          goForward: (options?: NavigationOptions) => Promise<Response | null>;
                                                                                                                                                                                          • Navigate to the next page in history.

                                                                                                                                                                                            Parameter options

                                                                                                                                                                                            The navigation parameters.

                                                                                                                                                                                          method isClosed

                                                                                                                                                                                          isClosed: () => boolean;
                                                                                                                                                                                          • Indicates that the page has been closed.

                                                                                                                                                                                          method isJavaScriptEnabled

                                                                                                                                                                                          isJavaScriptEnabled: () => boolean;
                                                                                                                                                                                          • Returns

                                                                                                                                                                                            true if the page has JavaScript enabled, false otherwise.

                                                                                                                                                                                          method mainFrame

                                                                                                                                                                                          mainFrame: () => Frame;
                                                                                                                                                                                          • Page is guaranteed to have a main frame which persists during navigation's.

                                                                                                                                                                                          method metrics

                                                                                                                                                                                          metrics: () => Promise<Metrics>;
                                                                                                                                                                                          • Gets the page metrics.

                                                                                                                                                                                          method on

                                                                                                                                                                                          on: <K extends keyof PageEventObj>(
                                                                                                                                                                                          eventName: K,
                                                                                                                                                                                          handler: (e: PageEventObj[K], ...args: any[]) => void
                                                                                                                                                                                          ) => this;
                                                                                                                                                                                          • Adds the listener function to the end of the listeners array for the event named eventName. No checks are made to see if the listener has already been added. Multiple calls passing the same combination of eventName and listener will result in the listener being added, and called, multiple times.

                                                                                                                                                                                            Parameter event

                                                                                                                                                                                            The name of the event.

                                                                                                                                                                                            Parameter handler

                                                                                                                                                                                            The callback function.

                                                                                                                                                                                          method once

                                                                                                                                                                                          once: <K extends keyof PageEventObj>(
                                                                                                                                                                                          eventName: K,
                                                                                                                                                                                          handler: (e: PageEventObj[K], ...args: any[]) => void
                                                                                                                                                                                          ) => this;
                                                                                                                                                                                          • Adds a one time listener function for the event named eventName. The next time eventName is triggered, this listener is removed and then invoked.

                                                                                                                                                                                            Parameter event

                                                                                                                                                                                            The name of the event.

                                                                                                                                                                                            Parameter handler

                                                                                                                                                                                            The callback function.

                                                                                                                                                                                          method pdf

                                                                                                                                                                                          pdf: (options?: PDFOptions) => Promise<Buffer>;
                                                                                                                                                                                          • Generates a PDF of the page with print css media. To generate a pdf with screen media, call page.emulateMedia('screen') before calling page.pdf():

                                                                                                                                                                                            Parameter options

                                                                                                                                                                                            The PDF parameters.

                                                                                                                                                                                          method queryObjects

                                                                                                                                                                                          queryObjects: (prototypeHandle: JSHandle) => Promise<JSHandle>;
                                                                                                                                                                                          • The method iterates JavaScript heap and finds all the objects with the given prototype.

                                                                                                                                                                                            Parameter prototypeHandle

                                                                                                                                                                                            A handle to the object prototype.

                                                                                                                                                                                          method reload

                                                                                                                                                                                          reload: (options?: NavigationOptions) => Promise<Response>;
                                                                                                                                                                                          • Reloads the current page.

                                                                                                                                                                                            Parameter options

                                                                                                                                                                                            The navigation parameters.

                                                                                                                                                                                          method screenshot

                                                                                                                                                                                          screenshot: {
                                                                                                                                                                                          (options?: Base64ScreenShotOptions): Promise<string>;
                                                                                                                                                                                          (options?: BinaryScreenShotOptions): Promise<any>;
                                                                                                                                                                                          (options?: ScreenshotOptions): Promise<any>;
                                                                                                                                                                                          };
                                                                                                                                                                                          • Captures a screenshot of the page.

                                                                                                                                                                                            Parameter options

                                                                                                                                                                                            The screenshot options.

                                                                                                                                                                                          method setBypassCSP

                                                                                                                                                                                          setBypassCSP: (enabled: boolean) => Promise<void>;
                                                                                                                                                                                          • Toggles bypassing page's Content-Security-Policy. NOTE CSP bypassing happens at the moment of CSP initialization rather then evaluation. Usually this means that page.setBypassCSP should be called before navigating to the domain.

                                                                                                                                                                                            Parameter enabled

                                                                                                                                                                                            sets bypassing of page's Content-Security-Policy.

                                                                                                                                                                                          method setCacheEnabled

                                                                                                                                                                                          setCacheEnabled: (enabled?: boolean) => Promise<void>;
                                                                                                                                                                                          • Determines whether cache is enabled on the page.

                                                                                                                                                                                            Parameter enabled

                                                                                                                                                                                            Whether or not to enable cache on the page.

                                                                                                                                                                                          method setCookie

                                                                                                                                                                                          setCookie: (...cookies: SetCookie[]) => Promise<void>;
                                                                                                                                                                                          • Sets the cookies on the page.

                                                                                                                                                                                            Parameter cookies

                                                                                                                                                                                            The cookies to set.

                                                                                                                                                                                          method setDefaultNavigationTimeout

                                                                                                                                                                                          setDefaultNavigationTimeout: (timeout: number) => void;
                                                                                                                                                                                          • This setting will change the default maximum navigation time of 30 seconds for the following methods: - page.goto - page.goBack - page.goForward - page.reload - page.waitForNavigation

                                                                                                                                                                                          method setDefaultTimeout

                                                                                                                                                                                          setDefaultTimeout: (timeout: number) => void;
                                                                                                                                                                                          • This setting will change the default maximum time for the following methods and related shortcuts: - page.goBack - page.goForward - page.goto - page.reload - page.setContent - page.waitFor - page.waitForFunction - page.waitForNavigation - page.waitForRequest - page.waitForResponse - page.waitForSelector - page.waitForXPath

                                                                                                                                                                                            NOTE page.setDefaultNavigationTimeout takes priority over page.setDefaultTimeout

                                                                                                                                                                                          method setExtraHTTPHeaders

                                                                                                                                                                                          setExtraHTTPHeaders: (headers: Headers) => Promise<void>;
                                                                                                                                                                                          • The extra HTTP headers will be sent with every request the page initiates.

                                                                                                                                                                                            Parameter headers

                                                                                                                                                                                            An object containing additional http headers to be sent with every request. All header values must be strings.

                                                                                                                                                                                          method setGeolocation

                                                                                                                                                                                          setGeolocation: (options: GeoOptions) => Promise<void>;
                                                                                                                                                                                          • Sets the page's geolocation.

                                                                                                                                                                                          method setJavaScriptEnabled

                                                                                                                                                                                          setJavaScriptEnabled: (enabled: boolean) => Promise<void>;
                                                                                                                                                                                          • Determines whether JavaScript is enabled on the page.

                                                                                                                                                                                            Parameter enable

                                                                                                                                                                                            Whether or not to enable JavaScript on the page.

                                                                                                                                                                                          method setOfflineMode

                                                                                                                                                                                          setOfflineMode: (enabled: boolean) => Promise<void>;
                                                                                                                                                                                          • Determines whether the offline mode is enabled.

                                                                                                                                                                                            Parameter enabled

                                                                                                                                                                                            When true, enables the offline mode for the page.

                                                                                                                                                                                          method setRequestInterception

                                                                                                                                                                                          setRequestInterception: (enabled: boolean) => Promise<void>;
                                                                                                                                                                                          • Determines whether the request interception is enabled.

                                                                                                                                                                                            Parameter enabled

                                                                                                                                                                                            When true the methods request.abort, request.continue and request.respond must be used.

                                                                                                                                                                                          method setUserAgent

                                                                                                                                                                                          setUserAgent: (userAgent: string) => Promise<void>;
                                                                                                                                                                                          • Specifies the User-Agent used in this page.

                                                                                                                                                                                            Parameter userAgent

                                                                                                                                                                                            The user-agent to be used in the page.

                                                                                                                                                                                          method setViewport

                                                                                                                                                                                          setViewport: (viewport: Viewport) => Promise<void>;
                                                                                                                                                                                          • Sets the viewport of the page.

                                                                                                                                                                                            Parameter viewport

                                                                                                                                                                                            The viewport parameters.

                                                                                                                                                                                          method target

                                                                                                                                                                                          target: () => Target;
                                                                                                                                                                                          • Returns

                                                                                                                                                                                            The target this page was created from

                                                                                                                                                                                          method title

                                                                                                                                                                                          title: () => Promise<string>;
                                                                                                                                                                                          • Returns the page's title.

                                                                                                                                                                                          method url

                                                                                                                                                                                          url: () => string;
                                                                                                                                                                                          • The page's URL. This is a shortcut for page.mainFrame().url()

                                                                                                                                                                                          method viewport

                                                                                                                                                                                          viewport: () => Viewport;
                                                                                                                                                                                          • Gets the page viewport.

                                                                                                                                                                                          method waitForFileChooser

                                                                                                                                                                                          waitForFileChooser: (options?: Timeoutable) => Promise<FileChooser>;
                                                                                                                                                                                          • In non-headless Chromium, this method results in the native file picker dialog not showing up for the user. This method is typically coupled with an action that triggers file choosing. This must be called before the file chooser is launched. It will not return a currently active file chooser.

                                                                                                                                                                                          method waitForRequest

                                                                                                                                                                                          waitForRequest: (
                                                                                                                                                                                          urlOrPredicate: string | ((req: Request) => boolean),
                                                                                                                                                                                          options?: Timeoutable
                                                                                                                                                                                          ) => Promise<Request>;

                                                                                                                                                                                            method waitForResponse

                                                                                                                                                                                            waitForResponse: (
                                                                                                                                                                                            urlOrPredicate: string | ((res: Response) => boolean),
                                                                                                                                                                                            options?: Timeoutable
                                                                                                                                                                                            ) => Promise<Response>;

                                                                                                                                                                                              method workers

                                                                                                                                                                                              workers: () => Worker[];
                                                                                                                                                                                              • This method returns all of the dedicated WebWorkers associated with the page.

                                                                                                                                                                                              interface PageCloseOptions

                                                                                                                                                                                              interface PageCloseOptions {}

                                                                                                                                                                                                property runBeforeUnload

                                                                                                                                                                                                runBeforeUnload?: boolean;
                                                                                                                                                                                                • Whether to run the before unload page handlers. false

                                                                                                                                                                                                interface PageEventObj

                                                                                                                                                                                                interface PageEventObj {}

                                                                                                                                                                                                  property close

                                                                                                                                                                                                  close: undefined;
                                                                                                                                                                                                  • Emitted when the page closes.

                                                                                                                                                                                                  property console

                                                                                                                                                                                                  console: ConsoleMessage;
                                                                                                                                                                                                  • Emitted when JavaScript within the page calls one of console API methods, e.g. console.log or console.dir. Also emitted if the page throws an error or a warning.

                                                                                                                                                                                                  property dialog

                                                                                                                                                                                                  dialog: Dialog;
                                                                                                                                                                                                  • Emitted when a JavaScript dialog appears, such as alert, prompt, confirm or beforeunload. Puppeteer can respond to the dialog via Dialog's accept or dismiss methods.

                                                                                                                                                                                                  property domcontentloaded

                                                                                                                                                                                                  domcontentloaded: never;
                                                                                                                                                                                                  • Emitted when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, and subframes to finish loading.

                                                                                                                                                                                                  property error

                                                                                                                                                                                                  error: Error;
                                                                                                                                                                                                  • Emitted when the page crashes.

                                                                                                                                                                                                  property frameattached

                                                                                                                                                                                                  frameattached: Frame;
                                                                                                                                                                                                  • Emitted when a frame is attached.

                                                                                                                                                                                                  property framedetached

                                                                                                                                                                                                  framedetached: Frame;
                                                                                                                                                                                                  • Emitted when a frame is detached.

                                                                                                                                                                                                  property framenavigated

                                                                                                                                                                                                  framenavigated: Frame;
                                                                                                                                                                                                  • Emitted when a frame is navigated to a new url.

                                                                                                                                                                                                  property load

                                                                                                                                                                                                  load: undefined;
                                                                                                                                                                                                  • Emitted when the JavaScript load event is dispatched.

                                                                                                                                                                                                  property metrics

                                                                                                                                                                                                  metrics: { title: string; metrics: Metrics };
                                                                                                                                                                                                  • Emitted when the JavaScript code makes a call to console.timeStamp. For the list of metrics see page.metrics.

                                                                                                                                                                                                  property pageerror

                                                                                                                                                                                                  pageerror: Error;
                                                                                                                                                                                                  • Emitted when an uncaught exception happens within the page.

                                                                                                                                                                                                  property popup

                                                                                                                                                                                                  popup: Page;
                                                                                                                                                                                                  • Emitted when the page opens a new tab or window.

                                                                                                                                                                                                  property request

                                                                                                                                                                                                  request: Request;
                                                                                                                                                                                                  • Emitted when a page issues a request. The request object is read-only. In order to intercept and mutate requests, see page.setRequestInterceptionEnabled.

                                                                                                                                                                                                  property requestfailed

                                                                                                                                                                                                  requestfailed: Request;
                                                                                                                                                                                                  • Emitted when a request fails, for example by timing out.

                                                                                                                                                                                                  property requestfinished

                                                                                                                                                                                                  requestfinished: Request;
                                                                                                                                                                                                  • Emitted when a request finishes successfully.

                                                                                                                                                                                                  property response

                                                                                                                                                                                                  response: Response;
                                                                                                                                                                                                  • Emitted when a response is received.

                                                                                                                                                                                                  property workercreated

                                                                                                                                                                                                  workercreated: Worker;
                                                                                                                                                                                                  • Emitted when a dedicated WebWorker is spawned by the page.

                                                                                                                                                                                                  property workerdestroyed

                                                                                                                                                                                                  workerdestroyed: Worker;
                                                                                                                                                                                                  • Emitted when a dedicated WebWorker is terminated.

                                                                                                                                                                                                  interface PageFnOptions

                                                                                                                                                                                                  interface PageFnOptions extends Timeoutable {}

                                                                                                                                                                                                    property polling

                                                                                                                                                                                                    polling?: 'raf' | 'mutation' | number;

                                                                                                                                                                                                      interface PDFOptions

                                                                                                                                                                                                      interface PDFOptions {}

                                                                                                                                                                                                        property displayHeaderFooter

                                                                                                                                                                                                        displayHeaderFooter?: boolean;
                                                                                                                                                                                                        • Display header and footer. false

                                                                                                                                                                                                        property footerTemplate

                                                                                                                                                                                                        footerTemplate?: string;
                                                                                                                                                                                                        • HTML template for the print footer. Should be valid HTML markup with following classes used to inject printing values into them: - date formatted print date - title document title - url document location - pageNumber current page number - totalPages total pages in the document

                                                                                                                                                                                                        property format

                                                                                                                                                                                                        format?: PDFFormat;
                                                                                                                                                                                                        • Paper format. If set, takes priority over width or height options. 'Letter'

                                                                                                                                                                                                        property headerTemplate

                                                                                                                                                                                                        headerTemplate?: string;
                                                                                                                                                                                                        • HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: - date formatted print date - title document title - url document location - pageNumber current page number - totalPages total pages in the document

                                                                                                                                                                                                        property height

                                                                                                                                                                                                        height?: LayoutDimension;
                                                                                                                                                                                                        • Paper height.

                                                                                                                                                                                                        property landscape

                                                                                                                                                                                                        landscape?: boolean;
                                                                                                                                                                                                        • Paper orientation. false

                                                                                                                                                                                                        property margin

                                                                                                                                                                                                        margin?: {
                                                                                                                                                                                                        /** Top margin. */
                                                                                                                                                                                                        top?: LayoutDimension;
                                                                                                                                                                                                        /** Right margin. */
                                                                                                                                                                                                        right?: LayoutDimension;
                                                                                                                                                                                                        /** Bottom margin. */
                                                                                                                                                                                                        bottom?: LayoutDimension;
                                                                                                                                                                                                        /** Left margin. */
                                                                                                                                                                                                        left?: LayoutDimension;
                                                                                                                                                                                                        };
                                                                                                                                                                                                        • Paper margins, defaults to none.

                                                                                                                                                                                                        property pageRanges

                                                                                                                                                                                                        pageRanges?: string;
                                                                                                                                                                                                        • Paper ranges to print, e.g., '1-5, 8, 11-13'. '' which means print all pages.

                                                                                                                                                                                                        property path

                                                                                                                                                                                                        path?: string;
                                                                                                                                                                                                        • The file path to save the PDF to. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the PDF won't be saved to the disk.

                                                                                                                                                                                                        property preferCSSPageSize

                                                                                                                                                                                                        preferCSSPageSize?: boolean;
                                                                                                                                                                                                        • Give any CSS size declared in the page priority over what is declared in width and height or format options. false which will scale the content to fit the paper size.

                                                                                                                                                                                                        property printBackground

                                                                                                                                                                                                        printBackground?: boolean;
                                                                                                                                                                                                        • Print background graphics. false

                                                                                                                                                                                                        property scale

                                                                                                                                                                                                        scale?: number;
                                                                                                                                                                                                        • Scale of the webpage rendering. 1

                                                                                                                                                                                                        property width

                                                                                                                                                                                                        width?: LayoutDimension;
                                                                                                                                                                                                        • Paper width.

                                                                                                                                                                                                        interface RemoteInfo

                                                                                                                                                                                                        interface RemoteInfo {}

                                                                                                                                                                                                          property ip

                                                                                                                                                                                                          ip: string;
                                                                                                                                                                                                          • the IP address of the remote server

                                                                                                                                                                                                          property port

                                                                                                                                                                                                          port: number;
                                                                                                                                                                                                          • the port used to connect to the remote server

                                                                                                                                                                                                          interface Request

                                                                                                                                                                                                          interface Request {}
                                                                                                                                                                                                          • Represents a page request.

                                                                                                                                                                                                          method abort

                                                                                                                                                                                                          abort: (errorCode?: ErrorCode) => Promise<void>;
                                                                                                                                                                                                          • Aborts request. To use this, request interception should be enabled with page.setRequestInterception.

                                                                                                                                                                                                            Throws

                                                                                                                                                                                                            An exception is immediately thrown if the request interception is not enabled.

                                                                                                                                                                                                          method continue

                                                                                                                                                                                                          continue: (overrides?: Overrides) => Promise<void>;
                                                                                                                                                                                                          • Continues request with optional request overrides. To use this, request interception should be enabled with page.setRequestInterception.

                                                                                                                                                                                                            Throws

                                                                                                                                                                                                            An exception is immediately thrown if the request interception is not enabled.

                                                                                                                                                                                                          method failure

                                                                                                                                                                                                          failure: () => { errorText: string } | null;
                                                                                                                                                                                                          • Returns

                                                                                                                                                                                                            An object if the request failed, null otherwise.

                                                                                                                                                                                                          method frame

                                                                                                                                                                                                          frame: () => Frame | null;
                                                                                                                                                                                                          • Returns

                                                                                                                                                                                                            The Frame object that initiated the request, or null if navigating to error pages

                                                                                                                                                                                                          method headers

                                                                                                                                                                                                          headers: () => Headers;
                                                                                                                                                                                                          • An object with HTTP headers associated with the request. All header names are lower-case.

                                                                                                                                                                                                          method isNavigationRequest

                                                                                                                                                                                                          isNavigationRequest: () => boolean;
                                                                                                                                                                                                          • Whether this request is driving frame's navigation.

                                                                                                                                                                                                          method method

                                                                                                                                                                                                          method: () => HttpMethod;
                                                                                                                                                                                                          • Returns the request's method (GET, POST, etc.)

                                                                                                                                                                                                          method postData

                                                                                                                                                                                                          postData: () => string | undefined;
                                                                                                                                                                                                          • Contains the request's post body, if any.

                                                                                                                                                                                                          method redirectChain

                                                                                                                                                                                                          redirectChain: () => Request[];
                                                                                                                                                                                                          • A redirectChain is a chain of requests initiated to fetch a resource.

                                                                                                                                                                                                            - If there are no redirects and the request was successful, the chain will be empty. - If a server responds with at least a single redirect, then the chain will contain all the requests that were redirected.

                                                                                                                                                                                                            redirectChain is shared between all the requests of the same chain.

                                                                                                                                                                                                            1.2.0

                                                                                                                                                                                                          method resourceType

                                                                                                                                                                                                          resourceType: () => ResourceType;
                                                                                                                                                                                                          • Contains the request's resource type as it was perceived by the rendering engine.

                                                                                                                                                                                                          method respond

                                                                                                                                                                                                          respond: (response: RespondOptions) => Promise<void>;
                                                                                                                                                                                                          • Fulfills request with given response. To use this, request interception should be enabled with page.setRequestInterception.

                                                                                                                                                                                                            Parameter response

                                                                                                                                                                                                            The response options that will fulfill this request.

                                                                                                                                                                                                            Throws

                                                                                                                                                                                                            An exception is immediately thrown if the request interception is not enabled.

                                                                                                                                                                                                          method response

                                                                                                                                                                                                          response: () => Response | null;
                                                                                                                                                                                                          • A matching Response object, or null if the response has not been received yet.

                                                                                                                                                                                                          method url

                                                                                                                                                                                                          url: () => string;
                                                                                                                                                                                                          • Contains the URL of the request.

                                                                                                                                                                                                          interface RespondOptions

                                                                                                                                                                                                          interface RespondOptions {}
                                                                                                                                                                                                          • Options for Request.respond method

                                                                                                                                                                                                          property body

                                                                                                                                                                                                          body?: Buffer | string;
                                                                                                                                                                                                          • Specifies the response body.

                                                                                                                                                                                                          property contentType

                                                                                                                                                                                                          contentType?: string;
                                                                                                                                                                                                          • Specifies the Content-Type response header.

                                                                                                                                                                                                          property headers

                                                                                                                                                                                                          headers?: Headers;
                                                                                                                                                                                                          • Specifies the response headers.

                                                                                                                                                                                                          property status

                                                                                                                                                                                                          status?: number;
                                                                                                                                                                                                          • Specifies the response status code. 200

                                                                                                                                                                                                          interface Response

                                                                                                                                                                                                          interface Response {}
                                                                                                                                                                                                          • Response class represents responses which are received by page.

                                                                                                                                                                                                          method buffer

                                                                                                                                                                                                          buffer: () => Promise<Buffer>;
                                                                                                                                                                                                          • Promise which resolves to a buffer with response body.

                                                                                                                                                                                                          method frame

                                                                                                                                                                                                          frame: () => Frame | null;
                                                                                                                                                                                                          • A Frame that initiated this response, or null if navigating to error pages.

                                                                                                                                                                                                          method fromCache

                                                                                                                                                                                                          fromCache: () => boolean;
                                                                                                                                                                                                          • True if the response was served from either the browser's disk cache or memory cache.

                                                                                                                                                                                                          method fromServiceWorker

                                                                                                                                                                                                          fromServiceWorker: () => boolean;
                                                                                                                                                                                                          • True if the response was served by a service worker.

                                                                                                                                                                                                          method headers

                                                                                                                                                                                                          headers: () => Headers;
                                                                                                                                                                                                          • An object with HTTP headers associated with the response. All header names are lower-case.

                                                                                                                                                                                                          method json

                                                                                                                                                                                                          json: () => Promise<unknown>;
                                                                                                                                                                                                          • Promise which resolves to a JSON representation of response body.

                                                                                                                                                                                                            Throws

                                                                                                                                                                                                            This method will throw if the response body is not parsable via JSON.parse.

                                                                                                                                                                                                          method ok

                                                                                                                                                                                                          ok: () => boolean;
                                                                                                                                                                                                          • Contains a boolean stating whether the response was successful (status in the range 200-299) or not.

                                                                                                                                                                                                          method remoteAddress

                                                                                                                                                                                                          remoteAddress: () => RemoteInfo;
                                                                                                                                                                                                          • Returns remote connection info

                                                                                                                                                                                                          method request

                                                                                                                                                                                                          request: () => Request;
                                                                                                                                                                                                          • A matching Request object.

                                                                                                                                                                                                          method securityDetails

                                                                                                                                                                                                          securityDetails: () => SecurityDetails | null;
                                                                                                                                                                                                          • Returns an object with security details associated with the response.

                                                                                                                                                                                                          method status

                                                                                                                                                                                                          status: () => number;
                                                                                                                                                                                                          • Contains the status code of the response (e.g., 200 for a success).

                                                                                                                                                                                                          method statusText

                                                                                                                                                                                                          statusText: () => string;
                                                                                                                                                                                                          • Contains the status text of the response (e.g. usually an "OK" for a success).

                                                                                                                                                                                                          method text

                                                                                                                                                                                                          text: () => Promise<string>;
                                                                                                                                                                                                          • Promise which resolves to a text representation of response body.

                                                                                                                                                                                                          method url

                                                                                                                                                                                                          url: () => string;
                                                                                                                                                                                                          • Contains the URL of the response.

                                                                                                                                                                                                          interface RevisionInfo

                                                                                                                                                                                                          interface RevisionInfo {}

                                                                                                                                                                                                            property executablePath

                                                                                                                                                                                                            executablePath: string;
                                                                                                                                                                                                            • Path to the revision executable

                                                                                                                                                                                                            property folderPath

                                                                                                                                                                                                            folderPath: string;
                                                                                                                                                                                                            • Path to the extracted revision folder

                                                                                                                                                                                                            property local

                                                                                                                                                                                                            local: boolean;
                                                                                                                                                                                                            • whether the revision is locally available on disk

                                                                                                                                                                                                            property product

                                                                                                                                                                                                            product: Product;

                                                                                                                                                                                                              property revision

                                                                                                                                                                                                              revision: string;
                                                                                                                                                                                                              • The revision the info was created from

                                                                                                                                                                                                              property url

                                                                                                                                                                                                              url: string;
                                                                                                                                                                                                              • URL this revision can be downloaded from

                                                                                                                                                                                                              interface ScreenshotOptions

                                                                                                                                                                                                              interface ScreenshotOptions {}
                                                                                                                                                                                                              • Defines the screenshot options.

                                                                                                                                                                                                              property clip

                                                                                                                                                                                                              clip?: BoundingBox;
                                                                                                                                                                                                              • An object which specifies clipping region of the page.

                                                                                                                                                                                                              property encoding

                                                                                                                                                                                                              encoding?: 'base64' | 'binary';
                                                                                                                                                                                                              • The encoding of the image, can be either base64 or binary. binary

                                                                                                                                                                                                              property fullPage

                                                                                                                                                                                                              fullPage?: boolean;
                                                                                                                                                                                                              • When true, takes a screenshot of the full scrollable page. false

                                                                                                                                                                                                              property omitBackground

                                                                                                                                                                                                              omitBackground?: boolean;
                                                                                                                                                                                                              • Hides default white background and allows capturing screenshots with transparency. false

                                                                                                                                                                                                              property path

                                                                                                                                                                                                              path?: string;
                                                                                                                                                                                                              • The file path to save the image to. The screenshot type will be inferred from file extension. If path is a relative path, then it is resolved relative to current working directory. If no path is provided, the image won't be saved to the disk.

                                                                                                                                                                                                              property quality

                                                                                                                                                                                                              quality?: number;
                                                                                                                                                                                                              • The quality of the image, between 0-100. Not applicable to png images.

                                                                                                                                                                                                              property type

                                                                                                                                                                                                              type?: 'jpeg' | 'png';
                                                                                                                                                                                                              • The screenshot type. png

                                                                                                                                                                                                              interface ScriptTagOptions

                                                                                                                                                                                                              interface ScriptTagOptions {}
                                                                                                                                                                                                              • Options for addScriptTag

                                                                                                                                                                                                              property content

                                                                                                                                                                                                              content?: string;
                                                                                                                                                                                                              • Raw JavaScript content to be injected into frame.

                                                                                                                                                                                                              property path

                                                                                                                                                                                                              path?: string;
                                                                                                                                                                                                              • Path to the JavaScript file to be injected into frame. If path is a relative path, then it is resolved relative to current working directory.

                                                                                                                                                                                                              property type

                                                                                                                                                                                                              type?: string;
                                                                                                                                                                                                              • Script type. Use 'module' in order to load a Javascript ES6 module.

                                                                                                                                                                                                              property url

                                                                                                                                                                                                              url?: string;
                                                                                                                                                                                                              • Url of a script to be added.

                                                                                                                                                                                                              interface SecurityDetails

                                                                                                                                                                                                              interface SecurityDetails {}

                                                                                                                                                                                                                method issuer

                                                                                                                                                                                                                issuer: () => string;
                                                                                                                                                                                                                • A string with the name of issuer of the certificate. (e.g. "Let's Encrypt Authority X3").

                                                                                                                                                                                                                method protocol

                                                                                                                                                                                                                protocol: () => string;
                                                                                                                                                                                                                • String with the security protocol (e.g. TLS 1.2).

                                                                                                                                                                                                                method subjectName

                                                                                                                                                                                                                subjectName: () => string;
                                                                                                                                                                                                                • Name of the subject to which the certificate was issued to (e.g. "www.example.com").

                                                                                                                                                                                                                method validFrom

                                                                                                                                                                                                                validFrom: () => number;
                                                                                                                                                                                                                • Timestamp stating the start of validity of the certificate.

                                                                                                                                                                                                                method validTo

                                                                                                                                                                                                                validTo: () => number;
                                                                                                                                                                                                                • Timestamp stating the end of validity of the certificate.

                                                                                                                                                                                                                interface SetCookie

                                                                                                                                                                                                                interface SetCookie {}

                                                                                                                                                                                                                  property domain

                                                                                                                                                                                                                  domain?: string;
                                                                                                                                                                                                                  • The cookie domain.

                                                                                                                                                                                                                  property expires

                                                                                                                                                                                                                  expires?: number;
                                                                                                                                                                                                                  • The cookie Unix expiration time in seconds.

                                                                                                                                                                                                                  property httpOnly

                                                                                                                                                                                                                  httpOnly?: boolean;
                                                                                                                                                                                                                  • The cookie http only flag.

                                                                                                                                                                                                                  property name

                                                                                                                                                                                                                  name: string;
                                                                                                                                                                                                                  • The cookie name.

                                                                                                                                                                                                                  property path

                                                                                                                                                                                                                  path?: string;
                                                                                                                                                                                                                  • The cookie path.

                                                                                                                                                                                                                  property sameSite

                                                                                                                                                                                                                  sameSite?: SameSiteSetting;
                                                                                                                                                                                                                  • The cookie same site definition.

                                                                                                                                                                                                                  property secure

                                                                                                                                                                                                                  secure?: boolean;
                                                                                                                                                                                                                  • The cookie secure flag.

                                                                                                                                                                                                                  property session

                                                                                                                                                                                                                  session?: boolean;
                                                                                                                                                                                                                  • The session cookie flag.

                                                                                                                                                                                                                  property url

                                                                                                                                                                                                                  url?: string;
                                                                                                                                                                                                                  • The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie.

                                                                                                                                                                                                                  property value

                                                                                                                                                                                                                  value: string;
                                                                                                                                                                                                                  • The cookie value.

                                                                                                                                                                                                                  interface SnapshopOptions

                                                                                                                                                                                                                  interface SnapshopOptions {}

                                                                                                                                                                                                                    property interestingOnly

                                                                                                                                                                                                                    interestingOnly?: boolean;
                                                                                                                                                                                                                    • Prune uninteresting nodes from the tree. true

                                                                                                                                                                                                                    property root

                                                                                                                                                                                                                    root?: ElementHandle;
                                                                                                                                                                                                                    • The root DOM element for the snapshot. document.body

                                                                                                                                                                                                                    interface StartCoverageOptions

                                                                                                                                                                                                                    interface StartCoverageOptions {}

                                                                                                                                                                                                                      property reportAnonymousScripts

                                                                                                                                                                                                                      reportAnonymousScripts?: boolean;
                                                                                                                                                                                                                      • Whether anonymous scripts generated by the page should be reported. false

                                                                                                                                                                                                                      property resetOnNavigation

                                                                                                                                                                                                                      resetOnNavigation?: boolean;
                                                                                                                                                                                                                      • Whether to reset coverage on every navigation. true

                                                                                                                                                                                                                      interface StyleTagOptions

                                                                                                                                                                                                                      interface StyleTagOptions {}
                                                                                                                                                                                                                      • Options for addStyleTag

                                                                                                                                                                                                                      property content

                                                                                                                                                                                                                      content?: string;
                                                                                                                                                                                                                      • Raw CSS content to be injected into frame.

                                                                                                                                                                                                                      property path

                                                                                                                                                                                                                      path?: string;
                                                                                                                                                                                                                      • Path to the CSS file to be injected into frame. If path is a relative path, then it is resolved relative to current working directory.

                                                                                                                                                                                                                      property url

                                                                                                                                                                                                                      url?: string;
                                                                                                                                                                                                                      • Url of the tag.

                                                                                                                                                                                                                      interface Target

                                                                                                                                                                                                                      interface Target {}

                                                                                                                                                                                                                        method browser

                                                                                                                                                                                                                        browser: () => Browser;
                                                                                                                                                                                                                        • Get the browser the target belongs to.

                                                                                                                                                                                                                        method browserContext

                                                                                                                                                                                                                        browserContext: () => BrowserContext;
                                                                                                                                                                                                                        • The browser context the target belongs to.

                                                                                                                                                                                                                        method createCDPSession

                                                                                                                                                                                                                        createCDPSession: () => Promise<CDPSession>;
                                                                                                                                                                                                                        • Creates a Chrome Devtools Protocol session attached to the target.

                                                                                                                                                                                                                        method opener

                                                                                                                                                                                                                        opener: () => Target | null;
                                                                                                                                                                                                                        • Get the target that opened this target. Top-level targets return null.

                                                                                                                                                                                                                        method page

                                                                                                                                                                                                                        page: () => Promise<Page>;
                                                                                                                                                                                                                        • Returns the target Page or a null if the type of the page is not "page".

                                                                                                                                                                                                                        method type

                                                                                                                                                                                                                        type: () => TargetType;
                                                                                                                                                                                                                        • Identifies what kind of target this is.

                                                                                                                                                                                                                        method url

                                                                                                                                                                                                                        url: () => string;
                                                                                                                                                                                                                        • Returns the target URL.

                                                                                                                                                                                                                        method worker

                                                                                                                                                                                                                        worker: () => Promise<Worker | null>;
                                                                                                                                                                                                                        • If the target is not of type service_worker or shared_worker, resolves null.

                                                                                                                                                                                                                        interface TargetAwaiter

                                                                                                                                                                                                                        interface TargetAwaiter {}

                                                                                                                                                                                                                          method waitForTarget

                                                                                                                                                                                                                          waitForTarget: (
                                                                                                                                                                                                                          predicate: (target: Target) => boolean,
                                                                                                                                                                                                                          options?: Timeoutable
                                                                                                                                                                                                                          ) => Promise<Target>;

                                                                                                                                                                                                                            interface Timeoutable

                                                                                                                                                                                                                            interface Timeoutable {}

                                                                                                                                                                                                                              property timeout

                                                                                                                                                                                                                              timeout?: number;
                                                                                                                                                                                                                              • Maximum navigation time in milliseconds, pass 0 to disable timeout. 30000

                                                                                                                                                                                                                              interface Touchscreen

                                                                                                                                                                                                                              interface Touchscreen {}

                                                                                                                                                                                                                                method tap

                                                                                                                                                                                                                                tap: (x: number, y: number) => Promise<void>;
                                                                                                                                                                                                                                • Dispatches a touchstart and touchend event.

                                                                                                                                                                                                                                  Parameter x

                                                                                                                                                                                                                                  The x position.

                                                                                                                                                                                                                                  Parameter y

                                                                                                                                                                                                                                  The y position.

                                                                                                                                                                                                                                interface Tracing

                                                                                                                                                                                                                                interface Tracing {}
                                                                                                                                                                                                                                • You can use tracing.start and tracing.stop to create a trace file which can be opened in Chrome DevTools or timeline viewer.

                                                                                                                                                                                                                                method start

                                                                                                                                                                                                                                start: (options: TracingStartOptions) => Promise<void>;

                                                                                                                                                                                                                                  method stop

                                                                                                                                                                                                                                  stop: () => Promise<Buffer>;

                                                                                                                                                                                                                                    interface TracingStartOptions

                                                                                                                                                                                                                                    interface TracingStartOptions {}

                                                                                                                                                                                                                                      property categories

                                                                                                                                                                                                                                      categories?: string[];

                                                                                                                                                                                                                                        property path

                                                                                                                                                                                                                                        path?: string;

                                                                                                                                                                                                                                          property screenshots

                                                                                                                                                                                                                                          screenshots?: boolean;

                                                                                                                                                                                                                                            interface Viewport

                                                                                                                                                                                                                                            interface Viewport {}

                                                                                                                                                                                                                                              property deviceScaleFactor

                                                                                                                                                                                                                                              deviceScaleFactor?: number;
                                                                                                                                                                                                                                              • Specify device scale factor (can be thought of as dpr). 1

                                                                                                                                                                                                                                              property hasTouch

                                                                                                                                                                                                                                              hasTouch?: boolean;
                                                                                                                                                                                                                                              • Specifies if viewport supports touch events. false

                                                                                                                                                                                                                                              property height

                                                                                                                                                                                                                                              height: number;
                                                                                                                                                                                                                                              • The page height in pixels.

                                                                                                                                                                                                                                              property isLandscape

                                                                                                                                                                                                                                              isLandscape?: boolean;
                                                                                                                                                                                                                                              • Specifies if viewport is in landscape mode. false

                                                                                                                                                                                                                                              property isMobile

                                                                                                                                                                                                                                              isMobile?: boolean;
                                                                                                                                                                                                                                              • Whether the meta viewport tag is taken into account. false

                                                                                                                                                                                                                                              property width

                                                                                                                                                                                                                                              width: number;
                                                                                                                                                                                                                                              • The page width in pixels.

                                                                                                                                                                                                                                              interface WaitForSelectorOptions

                                                                                                                                                                                                                                              interface WaitForSelectorOptions extends Timeoutable {}

                                                                                                                                                                                                                                                property hidden

                                                                                                                                                                                                                                                hidden?: boolean;
                                                                                                                                                                                                                                                • Wait for element to not be found in the DOM or to be hidden, i.e. have display: none or visibility: hidden CSS properties. false

                                                                                                                                                                                                                                                property visible