Home Reference Source
public class | source

Page

Extends:

eventemitter3~EventEmitter → Page

Static Method Summary

Static Public Methods
public static

async create(client: CDPSession | CRIConnection | Chrome | Object, optionals: PageInitOptions): Promise<Page>

Constructor Summary

Public Constructor
public

constructor(client: Chrome | CRIConnection | CDPSession | Object, frameTree: Object, initOpts: PageInitOptions)

Member Summary

Public Members
public get
public get
since chrome-remote-interface-extra
public get
public get
since chrome-remote-interface-extra
public get
public get
public get
public get

mouse: Mouse: *

public get
public get
public get
public get
since chrome-remote-interface-extra
Private Members
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private
private

Method Summary

Public Methods
public

The method runs document.querySelector within the page.

public
public

$$eval(selector: string, pageFunction: Function | string, args: ...*): Promise<Object|undefined>

public

$eval(selector: string, pageFunction: Function | string, args: ...*): Promise<Object|undefined>

public

$x(expression: string): Promise<Array<ElementHandle>>

public

addScriptTag(options: {url?: string, path?: string, content?: string, type?: string}): Promise<ElementHandle>

public

Evaluates given script in every frame upon creation (before loading frame's scripts)

since chrome-remote-interface-extra
public

addStyleTag(options: {url?: string, path?: string, content?: string}): Promise<ElementHandle>

public

Returns T/F indicating if the Animation domain is enabled

since chrome-remote-interface-extra
public

authenticate(credentials: {username: string, password: string}): *

public

async bringToFront()

public

Returns the browser this page lives in if the page was created from the Browser class

public

Returns the browser context this page lives in if the page was created from the Browser class

public

async clearBrowserCache(): Promise<void>

since chrome-remote-interface-extra
public

Clears browser cookies

since chrome-remote-interface-extra
public

click(selector: string, options: {delay?: number, button?: "left"|"right"|"middle", clickCount?: number}): *

Clicks the element that the supplied selector matches.

public

async close(options: {runBeforeUnload: (boolean|undefined)}=)

public

Returns the string representation of the contents of the page (top frame)

public

Returns all browser cookies for the current URL.

since chrome-remote-interface-extra && puppeteer
public

Returns T/F indicating if the Database domain is enabled

since chrome-remote-interface-extra
public

Deletes the specified browser cookies with matching name and url or domain/path pair.

since chrome-remote-interface-extra
public

Deletes the specified browser cookies with matching name and url or domain/path pair.

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

async disableLogDomain(): Promise<void>

since chrome-remote-interface-extra
public

async disableNetworkCache(): Promise<void>

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

WorkerManager#disable

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

async emulate(options: {viewport: !Viewport, userAgent: string})

public

async emulateMedia(mediaType: string)

public
since chrome-remote-interface-extra
public

async enableDatabaseDomain(): Promise<void>

since chrome-remote-interface-extra
public

async enableLogDomain(): Promise<void>

since chrome-remote-interface-extra
public

async enableNetworkCache(): Promise<void>

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

async enableSecurityDomain(): Promise<void>

since chrome-remote-interface-extra
public

WorkerManager#enable

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

evaluate(pageFunction: Function | string, args: ...*): Promise<*>

Evaluates an arbitrary function or string in the pages (top frames) context

public

async evaluateHandle(pageFunction: Function | string, args: ...*): Promise<JSHandle>

public

async evaluateOnNewDocument(pageFunction: Function | string, args: ...*)

public

async exposeDevToolsProtocol(bindingName: string): Promise<void>

Inject object to the target's main frame that provides a communication channel with browser target.

Injected object will be available as window[bindingName].

The object has the following API:

  • binding.send(json) - a method to send messages over the remote debugging protocol
  • binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.

EXPERIMENTAL

since chrome-remote-interface-extra
public

async exposeFunction(name: string, puppeteerFunction: Function)

public

focus(selector: string): *

Focuses the element that the supplied selector matches.

public

Returns all frames contained in the page

public

Returns all browser cookies.

since chrome-remote-interface-extra
public

Gets the playback rate of animations.

since chrome-remote-interface-extra
public

getAppManifest(): Promise{url: string, errors: Array<Object>, data: ?string}>

since chrome-remote-interface-extra
public

Returns the DER-encoded certificate.

public
since chrome-remote-interface-extra
public

getLayoutMetrics(): Promise<{layoutviewport: Object, visualViewport: Object, contentSize: Object}>

Returns metrics relating to the layout of the page, such as viewport bounds/scale

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

getResourceContent(frameId: string, url: string): Promise<Buffer>

since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

goBack(options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined>

public

goForward(options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined>

public

goto(url: string, options: {referer?: string, timeout?: number, waitUntil?: string|Array<string>, transitionType?: string}=): Promise<Response|undefined>

public

hover(selector: string): *

Hovers the element that the supplied selector matches.

public

Toggles ignoring of service worker for each request.

since chrome-remote-interface-extra
public

Returns T/F indicating if the page is closed

public

Returns T/F indicating if the Log domain is enabled

since chrome-remote-interface-extra
public

Returns the top frame for the page

public

async metrics(): Promise<Metrics>

public

async navigateToHistoryEntry(entryId: number): Promise<void>

public

Returns a promise that resolves once this pages network has become idle.

since chrome-remote-interface-extra
public

async pdf(options: PDFOptions=): Promise<Buffer>

public

Returns T/F indicating if the Performance domain is enabled

since chrome-remote-interface-extra
public

async queryObjects(prototypeHandle: JSHandle): Promise<JSHandle>

public
since chrome-remote-interface-extra
public
since chrome-remote-interface-extra
public

querySelectorAllEval(selector: string, pageFunction: Function | String, args: ...*): Promise<Object|undefined>

since chrome-remote-interface-extra
public

querySelectorEval(selector: string, pageFunction: Function | String, args: ...*): Promise<Object|undefined>

since chrome-remote-interface-extra
public

async reload(options: {timeout?: number, waitUntil?: string|Array<string>, ignoreCache?: boolean, scriptToEvaluateOnLoad?: string}=): Promise<Response|undefined>

public
since chrome-remote-interface-extra
public
public

async screenshot(options: ScreenshotOptions=): Promise<Buffer|!String>

public

Returns T/F indicating if the Security domain is enabled

since chrome-remote-interface-extra
public

select(selector: string, values: ...string): Promise<Array<string>>

Selects the "select" elements that the supplied selector matches.

public

Returns all ServiceWorkers, if any, that are operating in the page The ServiceWorker domain must be enabled beforehand.

since chrome-remote-interface-extra
public

Returns T/F indicating if the ServiceWorker domain is enabled

since chrome-remote-interface-extra
public

async setAcceptLanguage(acceptLanguage: string)

since chrome-remote-interface-extra
public

setAnimationPlaybackRate(playbackRate: number): Promise<void>

Sets the playback rate of animations on the page.

since chrome-remote-interface-extra
public

setBlockedURLs(urls: ...string): Promise<void>

Blocks URLs from loading.

public

async setBypassCSP(enabled: boolean)

public

async setCacheEnabled(enabled: boolean)

public

async setContent(html: string, options: {timeout?: number, waitUntil?: string|Array<string>}=)

public
since chrome-remote-interface-extra
public

async setCookies(cookies: Array<CDPCookie|Cookie|string>): Promise<void>

Sets given cookies

since chrome-remote-interface-extra
public
public
public

async setDownloadBehavior(behavior: string, downloadPath: string): Promise<void>

Set the behavior when downloading a file.

since chrome-remote-interface-extra
public
public

async setGeolocation(options: {longitude: number, latitude: number, accuracy: number|undefined})

public

async setJavaScriptEnabled(enabled: boolean)

public

async setNavigatorPlatform(platform: string)

since chrome-remote-interface-extra
public

setOfflineMode(enabled: boolean): *

public
public

setUserAgent(userAgent: string): *

public

async setViewport(viewport: Viewport)

public

async stopLoading(): Promise<void>

Force the page stop all navigations and pending resource fetches

since chrome-remote-interface-extra
public

tap(selector: string): *

Taps the elements that the supplied selector matches.

public

Returns the Target class that represents this page if this page was initialized with one, e.g.

public

Returns the title of the page (top frame)

public

toJSON(): {frames: !FrameManager, javascriptEnabled: boolean, additionalDomains: EnabledExtras, workers: IterableIterator<Worker>, url: string, target: ?Target, network: !NetworkManager}

public

type(selector: string, text: string, options: {delay: (number|undefined)}=): *

Types the supplied text in the elements that the supplied selector matches.

public

url(): string

Returns the URL of the page (top frame)

public
public
public

waitFor(selectorOrFunctionOrTimeout: string | number | Function, options: Object=, args: ...*): Promise<JSHandle>

Waits for a selector or xpath or function or specified amount of time.

public

waitForFunction(pageFunction: Function, options: {polling?: string|number, timeout?: number}=, args: ...*): Promise<JSHandle>

public

waitForNavigation(options: {timeout?: number, waitUntil?: string|Array<string>}=): PromiseResponse>

public

waitForRequest(urlOrPredicate: string | Function, options: {timeout?: number}): Promise<Request>

public

waitForResponse(urlOrPredicate: string | Function, options: {timeout?: number}): Promise<Response>

public

waitForSelector(selector: string, options: {visible?: boolean, hidden?: boolean, timeout?: number}): Promise<ElementHandle|undefined>

Waits for a selector.

public

waitForXPath(xpath: string, options: {visible?: boolean, hidden?: boolean, timeout?: number}=): Promise<ElementHandle|undefined>

Waits for xpath.

public

Returns T/F indicating if Worker monitoring is enabled

since chrome-remote-interface-extra
public

Returns all workers, if any, that are operating in the page.

public
since chrome-remote-interface-extra
Private Methods
private
private
private
private

async _go(delta: *, options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined>

private

_handleException(exception: Object)

private

async _onBindingCalled(event: Object)

private
private

async _onConsoleAPI(event: Object)

private

_onDialog(event: *)

private
private
private

async _screenshotTask(format: "png" | "jpeg", options: ScreenshotOptions=): Promise<Buffer|!String>

Static Public Methods

public static async create(client: CDPSession | CRIConnection | Chrome | Object, optionals: PageInitOptions): Promise<Page> source

Params:

NameTypeAttributeDescription
client CDPSession | CRIConnection | Chrome | Object
optionals PageInitOptions
  • optional

Return:

Promise<Page>

Public Constructors

public constructor(client: Chrome | CRIConnection | CDPSession | Object, frameTree: Object, initOpts: PageInitOptions) source

Params:

NameTypeAttributeDescription
client Chrome | CRIConnection | CDPSession | Object
frameTree Object
  • nullable: false
initOpts PageInitOptions

Public Members

public get accessibility: Accessibility: * source

Return:

Accessibility (nullable: false)

public get animationManager: AnimationManager since chrome-remote-interface-extra source

public get coverage: Coverage: * source

Return:

Coverage (nullable: false)

public get databaseManager: DatabaseManager: * since chrome-remote-interface-extra source

Return:

DatabaseManager

public get frameManager: FrameManager: * source

Return:

FrameManager (nullable: false)

public get javascriptEnabled: boolean: * source

Return:

boolean

public get keyboard: Keyboard: * source

Return:

Keyboard (nullable: false)

public get mouse: Mouse: * source

Return:

Mouse (nullable: false)

public get networkManager: NetworkManager: * source

Return:

NetworkManager

public get touchscreen: Touchscreen: * source

Return:

Touchscreen (nullable: false)

public get tracing: Tracing: * source

Return:

Tracing (nullable: false)

public get workerManager: WorkerManager: * since chrome-remote-interface-extra source

Return:

WorkerManager

Private Members

private _accessibility: Accessibility source

private _additionalDomains: EnabledExtras source

private _animationManager: AnimationManager source

private _client: Chrome | CRIConnection | CDPSession | Object source

private _closed: boolean source

private _coverage: Coverage source

private _databaseManager: DatabaseManager source

private _emulationManager: EmulationManager source

private _frameManager: FrameManager source

private _ignoreHTTPSErrors: boolean source

private _javascriptEnabled: boolean source

private _keyboard: Keyboard source

private _mouse: Mouse source

private _networkManager: NetworkManager source

private _pageBindings: Map<string, Function> source

private _screenshotTaskQueue: TaskQueue source

private _target: Target source

private _targetId: string source

private _timeoutSettings: TimeoutSettings source

private _touchscreen: Touchscreen source

private _tracing: Tracing source

private _viewport: Viewport source

private _workerManager: WorkerManager source

Public Methods

public $(selector: string): Promise<ElementHandle|undefined> source

The method runs document.querySelector within the page. If no element matches the selector, the return value resolves to null.

Params:

NameTypeAttributeDescription
selector string

public $$(selector: string): Promise<Array<ElementHandle>> source

Params:

NameTypeAttributeDescription
selector string

public $$eval(selector: string, pageFunction: Function | string, args: ...*): Promise<Object|undefined> source

Params:

NameTypeAttributeDescription
selector string
pageFunction Function | string
args ...*

public $eval(selector: string, pageFunction: Function | string, args: ...*): Promise<Object|undefined> source

Params:

NameTypeAttributeDescription
selector string
pageFunction Function | string
args ...*

public $x(expression: string): Promise<Array<ElementHandle>> source

Params:

NameTypeAttributeDescription
expression string

public addScriptTag(options: {url?: string, path?: string, content?: string, type?: string}): Promise<ElementHandle> source

Params:

NameTypeAttributeDescription
options {url?: string, path?: string, content?: string, type?: string}

public async addScriptToEvaluateOnNewDocument(source: string, worldName: string): Promise<string> since chrome-remote-interface-extra source

Evaluates given script in every frame upon creation (before loading frame's scripts)

Params:

NameTypeAttributeDescription
source string

The string contents of the script

worldName string
  • optional

If specified, creates an isolated world with the given name and evaluates given script in it. This world name will be used as the ExecutionContextDescription::name when the corresponding event is emitted.

Return:

Promise<string>

Identifier of the added script

See:

public addStyleTag(options: {url?: string, path?: string, content?: string}): Promise<ElementHandle> source

Params:

NameTypeAttributeDescription
options {url?: string, path?: string, content?: string}

public animationsDomainEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if the Animation domain is enabled

Return:

boolean

public authenticate(credentials: {username: string, password: string}): * source

Params:

NameTypeAttributeDescription
credentials {username: string, password: string}
  • nullable: true

Return:

*

public async bringToFront() source

public browser(): Browser source

Returns the browser this page lives in if the page was created from the Browser class

Return:

Browser (nullable: true)

public browserContext(): BrowserContext source

Returns the browser context this page lives in if the page was created from the Browser class

Return:

BrowserContext (nullable: true)

public async clearBrowserCache(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public clearBrowserCookies(): Promise<void> since chrome-remote-interface-extra source

Clears browser cookies

Return:

Promise<void>

See:

public click(selector: string, options: {delay?: number, button?: "left"|"right"|"middle", clickCount?: number}): * source

Clicks the element that the supplied selector matches. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string
options {delay?: number, button?: "left"|"right"|"middle", clickCount?: number}
  • optional
  • nullable: false

Return:

*

public async close(options: {runBeforeUnload: (boolean|undefined)}=) source

Params:

NameTypeAttributeDescription
options {runBeforeUnload: (boolean|undefined)}=
  • nullable: false

public content(): Promise<string> source

Returns the string representation of the contents of the page (top frame)

Return:

Promise<string>

public cookies(urls: Array<string>): Promise<Array<Cookie>> since chrome-remote-interface-extra && puppeteer source

Returns all browser cookies for the current URL. Depending on the backend support, will return detailed cookie information in the cookies field.

Params:

NameTypeAttributeDescription
urls Array<string>

The list of URLs for which applicable cookies will be fetched

Return:

Promise<Array<Cookie>>

See:

public databaseDomainEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if the Database domain is enabled

Return:

boolean

public async deleteCookie(cookie: CDPCookie | CookieToBeDeleted | string | Cookie): Promise<void> since chrome-remote-interface-extra source

Deletes the specified browser cookies with matching name and url or domain/path pair.

Params:

NameTypeAttributeDescription
cookie CDPCookie | CookieToBeDeleted | string | Cookie

The cookie to be deleted

Return:

Promise<void>

See:

public async deleteCookies(cookies: Array<CDPCookie|CookieToBeDeleted|string|Cookie>): Promise<void> since chrome-remote-interface-extra source

Deletes the specified browser cookies with matching name and url or domain/path pair.

Params:

NameTypeAttributeDescription
cookies Array<CDPCookie|CookieToBeDeleted|string|Cookie>

The cookies to be deleted

Return:

Promise<void>

See:

public async disableAnimationsDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async disableDatabaseDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async disableLogDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async disableNetworkCache(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async disablePerformanceDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async disableSecurityDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async disableServiceWorkersDomain(): Promise<void> since chrome-remote-interface-extra source

WorkerManager#disable

Return:

Promise<void>

public async disableWorkerMonitoring(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async emulate(options: {viewport: !Viewport, userAgent: string}) source

Params:

NameTypeAttributeDescription
options {viewport: !Viewport, userAgent: string}
  • nullable: false

public async emulateMedia(mediaType: string) source

Params:

NameTypeAttributeDescription
mediaType string
  • nullable: true

public async enableAnimationsDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async enableDatabaseDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async enableLogDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async enableNetworkCache(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async enablePerformanceDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async enableSecurityDomain(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public async enableServiceWorkersDomain(): Promise<void> since chrome-remote-interface-extra source

WorkerManager#enable

Return:

Promise<void>

public async enableWorkerMonitoring(): Promise<void> since chrome-remote-interface-extra source

Return:

Promise<void>

public evaluate(pageFunction: Function | string, args: ...*): Promise<*> source

Evaluates an arbitrary function or string in the pages (top frames) context

Params:

NameTypeAttributeDescription
pageFunction Function | string
args ...*

Return:

Promise<*>

public async evaluateHandle(pageFunction: Function | string, args: ...*): Promise<JSHandle> source

Params:

NameTypeAttributeDescription
pageFunction Function | string
args ...*

Return:

Promise<JSHandle>

public async evaluateOnNewDocument(pageFunction: Function | string, args: ...*) source

Params:

NameTypeAttributeDescription
pageFunction Function | string
args ...*

public async exposeDevToolsProtocol(bindingName: string): Promise<void> since chrome-remote-interface-extra source

Inject object to the target's main frame that provides a communication channel with browser target.

Injected object will be available as window[bindingName].

The object has the following API:

  • binding.send(json) - a method to send messages over the remote debugging protocol
  • binding.onmessage = json => handleMessage(json) - a callback that will be called for the protocol notifications and command responses.

EXPERIMENTAL

Params:

NameTypeAttributeDescription
bindingName string
  • optional

Binding name, 'cdp' if not specified

Return:

Promise<void>

See:

public async exposeFunction(name: string, puppeteerFunction: Function) source

Params:

NameTypeAttributeDescription
name string
puppeteerFunction Function

public focus(selector: string): * source

Focuses the element that the supplied selector matches. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string

Return:

*

public frames(): Array<Frame> source

Returns all frames contained in the page

Return:

Array<Frame>

public getAllCookies(): Promise<Array<Cookie>> since chrome-remote-interface-extra source

Returns all browser cookies. Depending on the backend support, will return detailed cookie information in the cookies field.

Return:

Promise<Array<Cookie>>

See:

public getAnimationPlaybackRate(): Promise<number> since chrome-remote-interface-extra source

Gets the playback rate of animations. See also AnimationManager#getPlaybackRate

Return:

Promise<number>

public getAppManifest(): Promise{url: string, errors: Array<Object>, data: ?string}> since chrome-remote-interface-extra source

Return:

Promise{url: string, errors: Array<Object>, data: ?string}>

public getDEREncodedCertificateForOrigin(origin: string): Promise<Array<string>> source

Returns the DER-encoded certificate. EXPERIMENTAL

Params:

NameTypeAttributeDescription
origin string

Origin to get certificate for

Return:

Promise<Array<string>>

See:

public getElementById(elemId: string): Promise<ElementHandle|undefined> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
elemId string

See:

public getLayoutMetrics(): Promise<{layoutviewport: Object, visualViewport: Object, contentSize: Object}> since chrome-remote-interface-extra source

Returns metrics relating to the layout of the page, such as viewport bounds/scale

Return:

Promise<{layoutviewport: Object, visualViewport: Object, contentSize: Object}>

See:

public getResourceContent(frameId: string, url: string): Promise<Buffer> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
frameId string
url string

Return:

Promise<Buffer>

See:

public getResourceTree(): Promise<FrameResourceTree> since chrome-remote-interface-extra source

public goBack(options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> source

Params:

NameTypeAttributeDescription
options {timeout?: number, waitUntil?: string|Array<string>}=
  • nullable: false

public goForward(options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> source

Params:

NameTypeAttributeDescription
options {timeout?: number, waitUntil?: string|Array<string>}=
  • nullable: false

public goto(url: string, options: {referer?: string, timeout?: number, waitUntil?: string|Array<string>, transitionType?: string}=): Promise<Response|undefined> source

Params:

NameTypeAttributeDescription
url string
options {referer?: string, timeout?: number, waitUntil?: string|Array<string>, transitionType?: string}=
  • nullable: false

public hover(selector: string): * source

Hovers the element that the supplied selector matches. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string

Return:

*

public async httpRequestsBypassServiceWorker(bypass: boolean): Promise<void> since chrome-remote-interface-extra source

Toggles ignoring of service worker for each request. EXPERIMENTAL

Params:

NameTypeAttributeDescription
bypass boolean

Bypass service worker and load from network

Return:

Promise<void>

See:

public isClosed(): boolean source

Returns T/F indicating if the page is closed

Return:

boolean

public logDomainEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if the Log domain is enabled

Return:

boolean

public mainFrame(): Frame source

Returns the top frame for the page

Return:

Frame (nullable: false)

public async metrics(): Promise<Metrics> source

Return:

Promise<Metrics>

public async navigateToHistoryEntry(entryId: number): Promise<void> source

Params:

NameTypeAttributeDescription
entryId number

Return:

Promise<void>

public networkIdlePromise(options: NetIdleOptions): Promise<void> since chrome-remote-interface-extra source

Returns a promise that resolves once this pages network has become idle. Detection of network idle considers only the number of in-flight HTTP requests for the Page connected to.

Params:

NameTypeAttributeDescription
options NetIdleOptions
  • optional

Return:

Promise<void>

public async pdf(options: PDFOptions=): Promise<Buffer> source

Params:

NameTypeAttributeDescription
options PDFOptions=
  • nullable: false

Return:

Promise<Buffer>

public performanceDomainEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if the Performance domain is enabled

Return:

boolean

public async queryObjects(prototypeHandle: JSHandle): Promise<JSHandle> source

Params:

NameTypeAttributeDescription
prototypeHandle JSHandle
  • nullable: false

Return:

Promise<JSHandle>

public querySelector(selector: string): Promise<ElementHandle|undefined> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
selector string

public querySelectorAll(selector: string): Promise<Array<ElementHandle>> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
selector string

public querySelectorAllEval(selector: string, pageFunction: Function | String, args: ...*): Promise<Object|undefined> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
selector string
pageFunction Function | String
args ...*

public querySelectorEval(selector: string, pageFunction: Function | String, args: ...*): Promise<Object|undefined> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
selector string
pageFunction Function | String
args ...*

public async reload(options: {timeout?: number, waitUntil?: string|Array<string>, ignoreCache?: boolean, scriptToEvaluateOnLoad?: string}=): Promise<Response|undefined> source

Params:

NameTypeAttributeDescription
options {timeout?: number, waitUntil?: string|Array<string>, ignoreCache?: boolean, scriptToEvaluateOnLoad?: string}=
  • nullable: false

public async removeScriptToEvaluateOnNewDocument(identifier: string): Promise<void> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
identifier string

Identifier of the added script

Return:

Promise<void>

See:

public async resetNavigationHistory() source

public async screenshot(options: ScreenshotOptions=): Promise<Buffer|!String> source

Params:

NameTypeAttributeDescription
options ScreenshotOptions=
  • nullable: false

Return:

Promise<Buffer|!String>

public securityDomainEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if the Security domain is enabled

Return:

boolean

public select(selector: string, values: ...string): Promise<Array<string>> source

Selects the "select" elements that the supplied selector matches. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string
values ...string

Return:

Promise<Array<string>>

public serviceWorkers(): Array<ServiceWorker> since chrome-remote-interface-extra source

Returns all ServiceWorkers, if any, that are operating in the page The ServiceWorker domain must be enabled beforehand.

Return:

Array<ServiceWorker>

public serviceWorkersEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if the ServiceWorker domain is enabled

Return:

boolean

public async setAcceptLanguage(acceptLanguage: string) since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
acceptLanguage string

public setAnimationPlaybackRate(playbackRate: number): Promise<void> since chrome-remote-interface-extra source

Sets the playback rate of animations on the page.

Params:

NameTypeAttributeDescription
playbackRate number

Playback rate for animations on page

Return:

Promise<void>

public setBlockedURLs(urls: ...string): Promise<void> source

Blocks URLs from loading. EXPERIMENTAL

Params:

NameTypeAttributeDescription
urls ...string

URL patterns to block. Wildcards ('*') are allowed

Return:

Promise<void>

See:

public async setBypassCSP(enabled: boolean) source

Params:

NameTypeAttributeDescription
enabled boolean

public async setCacheEnabled(enabled: boolean) source

Params:

NameTypeAttributeDescription
enabled boolean

public async setContent(html: string, options: {timeout?: number, waitUntil?: string|Array<string>}=) source

Params:

NameTypeAttributeDescription
html string
options {timeout?: number, waitUntil?: string|Array<string>}=
  • nullable: false

public async setCookie(cookie: CDPCookie | Cookie | string): Promise<boolean> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
cookie CDPCookie | Cookie | string

The new cookie to be set

Return:

Promise<boolean>

T/F indicating if the cookie was set

See:

public async setCookies(cookies: Array<CDPCookie|Cookie|string>): Promise<void> since chrome-remote-interface-extra source

Sets given cookies

Params:

NameTypeAttributeDescription
cookies Array<CDPCookie|Cookie|string>

Return:

Promise<void>

See:

public setDefaultNavigationTimeout(timeout: number) source

Params:

NameTypeAttributeDescription
timeout number

public setDefaultTimeout(timeout: number) source

Params:

NameTypeAttributeDescription
timeout number

public async setDownloadBehavior(behavior: string, downloadPath: string): Promise<void> since chrome-remote-interface-extra source

Set the behavior when downloading a file. EXPERIMENTAL

Params:

NameTypeAttributeDescription
behavior string

Whether to allow all or deny all download requests, or use default Chrome behavior if available (otherwise deny). Allowed values: deny, allow, default

downloadPath string
  • optional

The default path to save downloaded files to. This is requred if behavior is set to 'allow'

Return:

Promise<void>

See:

public setExtraHTTPHeaders(headers: Object<string, string>): * source

Params:

NameTypeAttributeDescription
headers Object<string, string>
  • nullable: false

Return:

*

public async setGeolocation(options: {longitude: number, latitude: number, accuracy: number|undefined}) source

Params:

NameTypeAttributeDescription
options {longitude: number, latitude: number, accuracy: number|undefined}
  • nullable: false

public async setJavaScriptEnabled(enabled: boolean) source

Params:

NameTypeAttributeDescription
enabled boolean

public async setNavigatorPlatform(platform: string) since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
platform string

public setOfflineMode(enabled: boolean): * source

Params:

NameTypeAttributeDescription
enabled boolean

Return:

*

public async setRequestInterception(value: boolean) source

Params:

NameTypeAttributeDescription
value boolean

public setUserAgent(userAgent: string): * source

Params:

NameTypeAttributeDescription
userAgent string

Return:

*

public async setViewport(viewport: Viewport) source

Params:

NameTypeAttributeDescription
viewport Viewport
  • nullable: false

public async stopLoading(): Promise<void> since chrome-remote-interface-extra source

Force the page stop all navigations and pending resource fetches

Return:

Promise<void>

See:

public tap(selector: string): * source

Taps the elements that the supplied selector matches. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string

Return:

*

public target(): Target source

Returns the Target class that represents this page if this page was initialized with one, e.g. from the Browser class.

Return:

Target (nullable: true)

public title(): Promise<string> source

Returns the title of the page (top frame)

Return:

Promise<string>

public toJSON(): {frames: !FrameManager, javascriptEnabled: boolean, additionalDomains: EnabledExtras, workers: IterableIterator<Worker>, url: string, target: ?Target, network: !NetworkManager} source

Return:

{frames: !FrameManager, javascriptEnabled: boolean, additionalDomains: EnabledExtras, workers: IterableIterator<Worker>, url: string, target: ?Target, network: !NetworkManager}

public type(selector: string, text: string, options: {delay: (number|undefined)}=): * source

Types the supplied text in the elements that the supplied selector matches. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string
text string
options {delay: (number|undefined)}=

Return:

*

public url(): string source

Returns the URL of the page (top frame)

Return:

string (nullable: false)

public async userAgent(): Promise<string> source

Return:

Promise<string>

public viewport(): Viewport source

Return:

Viewport (nullable: true)

public waitFor(selectorOrFunctionOrTimeout: string | number | Function, options: Object=, args: ...*): Promise<JSHandle> source

Waits for a selector or xpath or function or specified amount of time. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selectorOrFunctionOrTimeout string | number | Function
options Object=
  • nullable: false
args ...*

Return:

Promise<JSHandle>

public waitForFunction(pageFunction: Function, options: {polling?: string|number, timeout?: number}=, args: ...*): Promise<JSHandle> source

Params:

NameTypeAttributeDescription
pageFunction Function
options {polling?: string|number, timeout?: number}=
  • nullable: false
args ...*

Return:

Promise<JSHandle>

public waitForNavigation(options: {timeout?: number, waitUntil?: string|Array<string>}=): PromiseResponse> source

Params:

NameTypeAttributeDescription
options {timeout?: number, waitUntil?: string|Array<string>}=
  • nullable: false

Return:

PromiseResponse>

public waitForRequest(urlOrPredicate: string | Function, options: {timeout?: number}): Promise<Request> source

Params:

NameTypeAttributeDescription
urlOrPredicate string | Function
options {timeout?: number}
  • optional

Return:

Promise<Request>

public waitForResponse(urlOrPredicate: string | Function, options: {timeout?: number}): Promise<Response> source

Params:

NameTypeAttributeDescription
urlOrPredicate string | Function
options {timeout?: number}
  • optional

Return:

Promise<Response>

public waitForSelector(selector: string, options: {visible?: boolean, hidden?: boolean, timeout?: number}): Promise<ElementHandle|undefined> source

Waits for a selector. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
selector string
options {visible?: boolean, hidden?: boolean, timeout?: number}
  • optional
  • nullable: false

public waitForXPath(xpath: string, options: {visible?: boolean, hidden?: boolean, timeout?: number}=): Promise<ElementHandle|undefined> source

Waits for xpath. Evaluation occurs within the context of the top frame

Params:

NameTypeAttributeDescription
xpath string
options {visible?: boolean, hidden?: boolean, timeout?: number}=
  • nullable: false

public workerMonitoringEnabled(): boolean since chrome-remote-interface-extra source

Returns T/F indicating if Worker monitoring is enabled

Return:

boolean

public workers(): Array<Worker> source

Returns all workers, if any, that are operating in the page. Worker monitoring must be enabled beforehand.

Return:

Array<Worker>

public xpathQuery(expression: string): Promise<Array<ElementHandle>> since chrome-remote-interface-extra source

Params:

NameTypeAttributeDescription
expression string

Private Methods

private __onClose() source

private _buildMetricsObject(metrics: Array<Object>): Metrics source

Params:

NameTypeAttributeDescription
metrics Array<Object>
  • nullable: true

Return:

Metrics (nullable: false)

private _emitMetrics(event: Object) source

Params:

NameTypeAttributeDescription
event Object
  • nullable: false

private async _go(delta: *, options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> source

Params:

NameTypeAttributeDescription
delta *
options {timeout?: number, waitUntil?: string|Array<string>}=
  • nullable: false

private _handleException(exception: Object) source

Params:

NameTypeAttributeDescription
exception Object
  • nullable: false

private async _onBindingCalled(event: Object) source

Params:

NameTypeAttributeDescription
event Object
  • nullable: false

private _onCertificateError(event: Object) source

Params:

NameTypeAttributeDescription
event Object
  • nullable: false

private async _onConsoleAPI(event: Object) source

Params:

NameTypeAttributeDescription
event Object
  • nullable: false

private _onDialog(event: *) source

Params:

NameTypeAttributeDescription
event *

private _onLogEntryAdded(event: Object): * source

Params:

NameTypeAttributeDescription
event Object
  • nullable: false

Return:

*

private _onTargetCrashed() source

private async _screenshotTask(format: "png" | "jpeg", options: ScreenshotOptions=): Promise<Buffer|!String> source

Params:

NameTypeAttributeDescription
format "png" | "jpeg"
options ScreenshotOptions=
  • nullable: false

Return:

Promise<Buffer|!String>