Page
Extends:
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 |
|
|
public get |
|
|
public get |
|
|
public get |
|
|
public get |
|
since chrome-remote-interface-extra |
Private Members | ||
private |
|
|
private |
|
|
private |
|
|
private |
_client: Chrome | CRIConnection | CDPSession | Object |
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
|
private |
|
Method Summary
Public Methods | ||
public |
$(selector: string): Promise<ElementHandle|undefined> The method runs document.querySelector within the page. |
|
public |
$$(selector: string): Promise<Array<ElementHandle>> |
|
public |
|
|
public |
|
|
public |
$x(expression: string): Promise<Array<ElementHandle>> |
|
public |
addScriptTag(options: {url?: string, path?: string, content?: string, type?: string}): Promise<ElementHandle> |
|
public |
async addScriptToEvaluateOnNewDocument(source: string, worldName: string): Promise<string> 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 |
clearBrowserCookies(): Promise<void> 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 |
async deleteCookie(cookie: CDPCookie | CookieToBeDeleted | string | Cookie): Promise<void> Deletes the specified browser cookies with matching name and url or domain/path pair. |
since chrome-remote-interface-extra |
public |
async deleteCookies(cookies: Array<CDPCookie|CookieToBeDeleted|string|Cookie>): Promise<void> Deletes the specified browser cookies with matching name and url or domain/path pair. |
since chrome-remote-interface-extra |
public |
async disableAnimationsDomain(): Promise<void> |
since chrome-remote-interface-extra |
public |
async disableDatabaseDomain(): Promise<void> |
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 |
async disablePerformanceDomain(): Promise<void> |
since chrome-remote-interface-extra |
public |
async disableSecurityDomain(): Promise<void> |
since chrome-remote-interface-extra |
public |
async disableServiceWorkersDomain(): Promise<void> WorkerManager#disable |
since chrome-remote-interface-extra |
public |
async disableWorkerMonitoring(): Promise<void> |
since chrome-remote-interface-extra |
public |
|
|
public |
async emulateMedia(mediaType: string) |
|
public |
async enableAnimationsDomain(): Promise<void> |
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 |
async enablePerformanceDomain(): Promise<void> |
since chrome-remote-interface-extra |
public |
async enableSecurityDomain(): Promise<void> |
since chrome-remote-interface-extra |
public |
async enableServiceWorkersDomain(): Promise<void> WorkerManager#enable |
since chrome-remote-interface-extra |
public |
async enableWorkerMonitoring(): Promise<void> |
since chrome-remote-interface-extra |
public |
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:
EXPERIMENTAL |
since chrome-remote-interface-extra |
public |
async exposeFunction(name: string, puppeteerFunction: Function) |
|
public |
Focuses the element that the supplied selector matches. |
|
public |
Returns all frames contained in the page |
|
public |
getAllCookies(): Promise<Array<Cookie>> 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 |
getDEREncodedCertificateForOrigin(origin: string): Promise<Array<string>> Returns the DER-encoded certificate. |
|
public |
getElementById(elemId: string): Promise<ElementHandle|undefined> |
since chrome-remote-interface-extra |
public |
getLayoutMetrics(): Promise<{layoutviewport: Object, visualViewport: Object, contentSize: Object}>{layoutviewport:> 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 |
|
|
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 |
Hovers the element that the supplied selector matches. |
|
public |
async httpRequestsBypassServiceWorker(bypass: boolean): Promise<void> 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 |
|
|
public |
async navigateToHistoryEntry(entryId: number): Promise<void> |
|
public |
networkIdlePromise(options: NetIdleOptions): Promise<void> Returns a promise that resolves once this pages network has become idle. |
since chrome-remote-interface-extra |
public |
|
|
public |
Returns T/F indicating if the Performance domain is enabled |
since chrome-remote-interface-extra |
public |
async queryObjects(prototypeHandle: JSHandle): Promise<JSHandle> |
|
public |
querySelector(selector: string): Promise<ElementHandle|undefined> |
since chrome-remote-interface-extra |
public |
querySelectorAll(selector: string): Promise<Array<ElementHandle>> |
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 |
async removeScriptToEvaluateOnNewDocument(identifier: string): Promise<void> |
since chrome-remote-interface-extra |
public |
async resetNavigationHistory() |
|
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 |
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 |
Sets given cookies |
since chrome-remote-interface-extra |
public |
setDefaultNavigationTimeout(timeout: number) |
|
public |
setDefaultTimeout(timeout: number) |
|
public |
async setDownloadBehavior(behavior: string, downloadPath: string): Promise<void> Set the behavior when downloading a file. |
since chrome-remote-interface-extra |
public |
setExtraHTTPHeaders(headers: Object<string, string>): * |
|
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 |
async setRequestInterception(value: boolean) |
|
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 |
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 |
Types the supplied text in the elements that the supplied selector matches. |
|
public |
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 |
|
|
public |
|
|
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 |
xpathQuery(expression: string): Promise<Array<ElementHandle>> |
since chrome-remote-interface-extra |
Private Methods | ||
private |
|
|
private |
_buildMetricsObject(metrics: Array<Object>): Metrics |
|
private |
_emitMetrics(event: Object) |
|
private |
async _go(delta: *, options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> |
|
private |
_handleException(exception: Object) |
|
private |
async _onBindingCalled(event: Object) |
|
private |
_onCertificateError(event: Object) |
|
private |
async _onConsoleAPI(event: Object) |
|
private |
_onDialog(event: *) |
|
private |
_onLogEntryAdded(event: Object): * |
|
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:
Name | Type | Attribute | Description |
client | CDPSession | CRIConnection | Chrome | Object | ||
optionals | PageInitOptions |
|
Public Constructors
public constructor(client: Chrome | CRIConnection | CDPSession | Object, frameTree: Object, initOpts: PageInitOptions) source
Params:
Name | Type | Attribute | Description |
client | Chrome | CRIConnection | CDPSession | Object | ||
frameTree | Object |
|
|
initOpts | PageInitOptions |
Public Members
public get animationManager: AnimationManager since chrome-remote-interface-extra source
public get databaseManager: DatabaseManager: * since chrome-remote-interface-extra source
public get workerManager: WorkerManager: * since chrome-remote-interface-extra source
Private Members
private _accessibility: Accessibility source
private _additionalDomains: EnabledExtras source
private _animationManager: AnimationManager source
private _client: Chrome | CRIConnection | CDPSession | Object source
private _databaseManager: DatabaseManager source
private _emulationManager: EmulationManager source
private _frameManager: FrameManager source
private _networkManager: NetworkManager source
private _timeoutSettings: TimeoutSettings source
private _touchscreen: Touchscreen 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:
Name | Type | Attribute | Description |
selector | string |
public $$(selector: string): Promise<Array<ElementHandle>> source
Params:
Name | Type | Attribute | Description |
selector | string |
public $$eval(selector: string, pageFunction: Function | string, args: ...*): Promise<Object|undefined> source
public $eval(selector: string, pageFunction: Function | string, args: ...*): Promise<Object|undefined> source
public $x(expression: string): Promise<Array<ElementHandle>> source
Params:
Name | Type | Attribute | Description |
expression | string |
public addScriptTag(options: {url?: string, path?: string, content?: string, type?: string}): Promise<ElementHandle> source
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:
Name | Type | Attribute | Description |
source | string | The string contents of the script |
|
worldName | string |
|
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. |
public addStyleTag(options: {url?: string, path?: string, content?: string}): Promise<ElementHandle> source
public animationsDomainEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if the Animation domain is enabled
public async bringToFront() source
public browser(): Browser source
Returns the browser this page lives in if the page was created from the Browser class
public browserContext(): BrowserContext source
Returns the browser context this page lives in if the page was created from the Browser class
public clearBrowserCookies(): Promise<void> since chrome-remote-interface-extra source
Clears browser cookies
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
Return:
* |
public async close(options: {runBeforeUnload: (boolean|undefined)}=) source
Params:
Name | Type | Attribute | Description |
options | {runBeforeUnload: (boolean|undefined)}= |
|
public content(): Promise<string> source
Returns the string representation of the contents of the page (top frame)
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.
public databaseDomainEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if the Database domain is enabled
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:
Name | Type | Attribute | Description |
cookie | CDPCookie | CookieToBeDeleted | string | Cookie | The cookie to be deleted |
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:
Name | Type | Attribute | Description |
cookies | Array<CDPCookie|CookieToBeDeleted|string|Cookie> | The cookies to be deleted |
public async disableServiceWorkersDomain(): Promise<void> since chrome-remote-interface-extra source
WorkerManager#disable
public async emulate(options: {viewport: !Viewport, userAgent: string}) source
Params:
Name | Type | Attribute | Description |
options | {viewport: !Viewport, userAgent: string} |
|
public async emulateMedia(mediaType: string) source
Params:
Name | Type | Attribute | Description |
mediaType | string |
|
public async enableServiceWorkersDomain(): Promise<void> since chrome-remote-interface-extra source
WorkerManager#enable
public evaluate(pageFunction: Function | string, args: ...*): Promise<*> source
Evaluates an arbitrary function or string in the pages (top frames) context
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:
Name | Type | Attribute | Description |
bindingName | string |
|
Binding name, 'cdp' if not specified |
public focus(selector: string): * source
Focuses the element that the supplied selector matches. Evaluation occurs within the context of the top frame
Params:
Name | Type | Attribute | Description |
selector | string |
Return:
* |
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.
public getAnimationPlaybackRate(): Promise<number> since chrome-remote-interface-extra source
Gets the playback rate of animations. See also AnimationManager#getPlaybackRate
public getAppManifest(): Promise{url: string, errors: Array<Object>, data: ?string}> since chrome-remote-interface-extra source
public getDEREncodedCertificateForOrigin(origin: string): Promise<Array<string>> source
Returns the DER-encoded certificate. EXPERIMENTAL
Params:
Name | Type | Attribute | Description |
origin | string | Origin to get certificate for |
public getElementById(elemId: string): Promise<ElementHandle|undefined> since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
elemId | string |
public getLayoutMetrics(): Promise<{layoutviewport: Object, visualViewport: Object, contentSize: Object}>{layoutviewport:> since chrome-remote-interface-extra source
Returns metrics relating to the layout of the page, such as viewport bounds/scale
public getNavigationHistory(): PromiseCDPNavigationEntry> since chrome-remote-interface-extra source
public getResourceContent(frameId: string, url: string): Promise<Buffer> since chrome-remote-interface-extra source
public getResourceTree(): Promise<FrameResourceTree> since chrome-remote-interface-extra source
public goBack(options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> source
Params:
Name | Type | Attribute | Description |
options | {timeout?: number, waitUntil?: string|Array<string>}= |
|
public goForward(options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> source
Params:
Name | Type | Attribute | Description |
options | {timeout?: number, waitUntil?: string|Array<string>}= |
|
public goto(url: string, options: {referer?: string, timeout?: number, waitUntil?: string|Array<string>, transitionType?: string}=): Promise<Response|undefined> source
Params:
Name | Type | Attribute | Description |
url | string | ||
options | {referer?: string, timeout?: number, waitUntil?: string|Array<string>, transitionType?: string}= |
|
public hover(selector: string): * source
Hovers the element that the supplied selector matches. Evaluation occurs within the context of the top frame
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
bypass | boolean | Bypass service worker and load from network |
public logDomainEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if the Log domain is enabled
public async navigateToHistoryEntry(entryId: number): Promise<void> source
Params:
Name | Type | Attribute | Description |
entryId | number |
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:
Name | Type | Attribute | Description |
options | NetIdleOptions |
|
public async pdf(options: PDFOptions=): Promise<Buffer> source
Params:
Name | Type | Attribute | Description |
options | PDFOptions= |
|
public performanceDomainEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if the Performance domain is enabled
public async queryObjects(prototypeHandle: JSHandle): Promise<JSHandle> source
Params:
Name | Type | Attribute | Description |
prototypeHandle | JSHandle |
|
public querySelector(selector: string): Promise<ElementHandle|undefined> since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
selector | string |
public querySelectorAll(selector: string): Promise<Array<ElementHandle>> since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
selector | string |
public querySelectorAllEval(selector: string, pageFunction: Function | String, args: ...*): Promise<Object|undefined> since chrome-remote-interface-extra source
public querySelectorEval(selector: string, pageFunction: Function | String, args: ...*): Promise<Object|undefined> since chrome-remote-interface-extra source
public async reload(options: {timeout?: number, waitUntil?: string|Array<string>, ignoreCache?: boolean, scriptToEvaluateOnLoad?: string}=): Promise<Response|undefined> source
Params:
Name | Type | Attribute | Description |
options | {timeout?: number, waitUntil?: string|Array<string>, ignoreCache?: boolean, scriptToEvaluateOnLoad?: string}= |
|
public async removeScriptToEvaluateOnNewDocument(identifier: string): Promise<void> since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
identifier | string | Identifier of the added script |
public async resetNavigationHistory() source
public async screenshot(options: ScreenshotOptions=): Promise<Buffer|!String> source
Params:
Name | Type | Attribute | Description |
options | ScreenshotOptions= |
|
public securityDomainEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if the Security domain is enabled
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
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.
public serviceWorkersEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if the ServiceWorker domain is enabled
public async setAcceptLanguage(acceptLanguage: string) since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
acceptLanguage | string |
public setAnimationPlaybackRate(playbackRate: number): Promise<void> since chrome-remote-interface-extra source
Sets the playback rate of animations on the page.
Params:
Name | Type | Attribute | Description |
playbackRate | number | Playback rate for animations on page |
public setBlockedURLs(urls: ...string): Promise<void> source
Blocks URLs from loading. EXPERIMENTAL
Params:
Name | Type | Attribute | Description |
urls | ...string | URL patterns to block. Wildcards ('*') are allowed |
public async setBypassCSP(enabled: boolean) source
Params:
Name | Type | Attribute | Description |
enabled | boolean |
public async setCacheEnabled(enabled: boolean) source
Params:
Name | Type | Attribute | Description |
enabled | boolean |
public async setContent(html: string, options: {timeout?: number, waitUntil?: string|Array<string>}=) source
Params:
Name | Type | Attribute | Description |
html | string | ||
options | {timeout?: number, waitUntil?: string|Array<string>}= |
|
public async setCookie(cookie: CDPCookie | Cookie | string): Promise<boolean> since chrome-remote-interface-extra source
public async setCookies(cookies: Array<CDPCookie|Cookie|string>): Promise<void> since chrome-remote-interface-extra source
Sets given cookies
public setDefaultNavigationTimeout(timeout: number) source
Params:
Name | Type | Attribute | Description |
timeout | number |
public setDefaultTimeout(timeout: number) source
Params:
Name | Type | Attribute | Description |
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:
Name | Type | Attribute | Description |
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 |
|
The default path to save downloaded files to. This is requred if behavior is set to 'allow' |
public async setGeolocation(options: {longitude: number, latitude: number, accuracy: number|undefined}) source
public async setJavaScriptEnabled(enabled: boolean) source
Params:
Name | Type | Attribute | Description |
enabled | boolean |
public async setNavigatorPlatform(platform: string) since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
platform | string |
public setOfflineMode(enabled: boolean): * source
Params:
Name | Type | Attribute | Description |
enabled | boolean |
Return:
* |
public async setRequestInterception(value: boolean) source
Params:
Name | Type | Attribute | Description |
value | boolean |
public setUserAgent(userAgent: string): * source
Params:
Name | Type | Attribute | Description |
userAgent | string |
Return:
* |
public async setViewport(viewport: Viewport) source
Params:
Name | Type | Attribute | Description |
viewport | Viewport |
|
public async stopLoading(): Promise<void> since chrome-remote-interface-extra source
Force the page stop all navigations and pending resource fetches
public tap(selector: string): * source
Taps the elements that the supplied selector matches. Evaluation occurs within the context of the top frame
Params:
Name | Type | Attribute | Description |
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.
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
Return:
* |
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
public waitForFunction(pageFunction: Function, options: {polling?: string|number, timeout?: number}=, args: ...*): Promise<JSHandle> source
Params:
Name | Type | Attribute | Description |
pageFunction | Function | ||
options | {polling?: string|number, timeout?: number}= |
|
|
args | ...* |
public waitForNavigation(options: {timeout?: number, waitUntil?: string|Array<string>}=): PromiseResponse> source
Params:
Name | Type | Attribute | Description |
options | {timeout?: number, waitUntil?: string|Array<string>}= |
|
public waitForRequest(urlOrPredicate: string | Function, options: {timeout?: number}): Promise<Request> source
public waitForResponse(urlOrPredicate: string | Function, options: {timeout?: number}): Promise<Response> source
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
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:
Name | Type | Attribute | Description |
xpath | string | ||
options | {visible?: boolean, hidden?: boolean, timeout?: number}= |
|
public workerMonitoringEnabled(): boolean since chrome-remote-interface-extra source
Returns T/F indicating if Worker monitoring is enabled
public workers(): Array<Worker> source
Returns all workers, if any, that are operating in the page. Worker monitoring must be enabled beforehand.
public xpathQuery(expression: string): Promise<Array<ElementHandle>> since chrome-remote-interface-extra source
Params:
Name | Type | Attribute | Description |
expression | string |
Private Methods
private __onClose() source
private _emitMetrics(event: Object) source
Params:
Name | Type | Attribute | Description |
event | Object |
|
private async _go(delta: *, options: {timeout?: number, waitUntil?: string|Array<string>}=): Promise<Response|undefined> source
Params:
Name | Type | Attribute | Description |
delta | * | ||
options | {timeout?: number, waitUntil?: string|Array<string>}= |
|
private _handleException(exception: Object) source
Params:
Name | Type | Attribute | Description |
exception | Object |
|
private async _onBindingCalled(event: Object) source
Params:
Name | Type | Attribute | Description |
event | Object |
|
private _onCertificateError(event: Object) source
Params:
Name | Type | Attribute | Description |
event | Object |
|
private async _onConsoleAPI(event: Object) source
Params:
Name | Type | Attribute | Description |
event | Object |
|
private _onDialog(event: *) source
Params:
Name | Type | Attribute | Description |
event | * |
private _onLogEntryAdded(event: Object): * source
Params:
Name | Type | Attribute | Description |
event | Object |
|
Return:
* |