feat(api): add Page.isJavaScriptEnabled + mark properties as private (#5993)
Just one was used externally and I wrapped that up in a method. I think it's a useful method to provide (I can imagine wanting to know if JS is enabled on a page) so I think there's no harm here (I'd rather that then have JSHandle reach into a private variable).
This commit is contained in:
parent
354f9424ae
commit
b86ff21b64
@ -131,6 +131,7 @@
|
|||||||
* [page.goto(url[, options])](#pagegotourl-options)
|
* [page.goto(url[, options])](#pagegotourl-options)
|
||||||
* [page.hover(selector)](#pagehoverselector)
|
* [page.hover(selector)](#pagehoverselector)
|
||||||
* [page.isClosed()](#pageisclosed)
|
* [page.isClosed()](#pageisclosed)
|
||||||
|
* [page.isJavaScriptEnabled()](#pageisjavascriptenabled)
|
||||||
* [page.keyboard](#pagekeyboard)
|
* [page.keyboard](#pagekeyboard)
|
||||||
* [page.mainFrame()](#pagemainframe)
|
* [page.mainFrame()](#pagemainframe)
|
||||||
* [page.metrics()](#pagemetrics)
|
* [page.metrics()](#pagemetrics)
|
||||||
@ -1643,6 +1644,12 @@ Shortcut for [page.mainFrame().hover(selector)](#framehoverselector).
|
|||||||
|
|
||||||
Indicates that the page has been closed.
|
Indicates that the page has been closed.
|
||||||
|
|
||||||
|
#### page.isJavaScriptEnabled()
|
||||||
|
|
||||||
|
- returns: <[boolean]>
|
||||||
|
|
||||||
|
Returns `true` if the page has JavaScript enabled, `false` otherwise.
|
||||||
|
|
||||||
#### page.keyboard
|
#### page.keyboard
|
||||||
|
|
||||||
- returns: <[Keyboard]>
|
- returns: <[Keyboard]>
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_accessibility](./puppeteer.page._accessibility.md)
|
|
||||||
|
|
||||||
## Page.\_accessibility property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_accessibility: Accessibility;
|
|
||||||
```
|
|
@ -1,24 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_addConsoleMessage](./puppeteer.page._addconsolemessage.md)
|
|
||||||
|
|
||||||
## Page.\_addConsoleMessage() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_addConsoleMessage(type: string, args: JSHandle[], stackTrace?: Protocol.Runtime.StackTrace): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| type | string | |
|
|
||||||
| args | [JSHandle](./puppeteer.jshandle.md)<!-- -->\[\] | |
|
|
||||||
| stackTrace | Protocol.Runtime.StackTrace | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_buildMetricsObject](./puppeteer.page._buildmetricsobject.md)
|
|
||||||
|
|
||||||
## Page.\_buildMetricsObject() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_buildMetricsObject(metrics?: Protocol.Performance.Metric[]): Metrics;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| metrics | Protocol.Performance.Metric\[\] | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
Metrics
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_client](./puppeteer.page._client.md)
|
|
||||||
|
|
||||||
## Page.\_client property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_client: CDPSession;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_closed](./puppeteer.page._closed.md)
|
|
||||||
|
|
||||||
## Page.\_closed property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_closed: boolean;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_coverage](./puppeteer.page._coverage.md)
|
|
||||||
|
|
||||||
## Page.\_coverage property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_coverage: Coverage;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_disconnectPromise](./puppeteer.page._disconnectpromise.md)
|
|
||||||
|
|
||||||
## Page.\_disconnectPromise property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_disconnectPromise?: Promise<Error>;
|
|
||||||
```
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_emitMetrics](./puppeteer.page._emitmetrics.md)
|
|
||||||
|
|
||||||
## Page.\_emitMetrics() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_emitMetrics(event: Protocol.Performance.metricsPayload): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| event | Protocol.Performance.metricsPayload | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_emulationManager](./puppeteer.page._emulationmanager.md)
|
|
||||||
|
|
||||||
## Page.\_emulationManager property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_emulationManager: EmulationManager;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_fileChooserInterceptors](./puppeteer.page._filechooserinterceptors.md)
|
|
||||||
|
|
||||||
## Page.\_fileChooserInterceptors property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_fileChooserInterceptors: Set<Function>;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_frameManager](./puppeteer.page._framemanager.md)
|
|
||||||
|
|
||||||
## Page.\_frameManager property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_frameManager: FrameManager;
|
|
||||||
```
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_handleException](./puppeteer.page._handleexception.md)
|
|
||||||
|
|
||||||
## Page.\_handleException() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_handleException(exceptionDetails: Protocol.Runtime.ExceptionDetails): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| exceptionDetails | Protocol.Runtime.ExceptionDetails | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_javascriptEnabled](./puppeteer.page._javascriptenabled.md)
|
|
||||||
|
|
||||||
## Page.\_javascriptEnabled property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_javascriptEnabled: boolean;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_keyboard](./puppeteer.page._keyboard.md)
|
|
||||||
|
|
||||||
## Page.\_keyboard property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_keyboard: Keyboard;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_mouse](./puppeteer.page._mouse.md)
|
|
||||||
|
|
||||||
## Page.\_mouse property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_mouse: Mouse;
|
|
||||||
```
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_onBindingCalled](./puppeteer.page._onbindingcalled.md)
|
|
||||||
|
|
||||||
## Page.\_onBindingCalled() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_onBindingCalled(event: Protocol.Runtime.bindingCalledPayload): Promise<void>;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| event | Protocol.Runtime.bindingCalledPayload | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
Promise<void>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_onConsoleAPI](./puppeteer.page._onconsoleapi.md)
|
|
||||||
|
|
||||||
## Page.\_onConsoleAPI() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_onConsoleAPI(event: Protocol.Runtime.consoleAPICalledPayload): Promise<void>;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| event | Protocol.Runtime.consoleAPICalledPayload | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
Promise<void>
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_onDialog](./puppeteer.page._ondialog.md)
|
|
||||||
|
|
||||||
## Page.\_onDialog() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_onDialog(event: Protocol.Page.javascriptDialogOpeningPayload): void;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| event | Protocol.Page.javascriptDialogOpeningPayload | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
void
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_onFileChooser](./puppeteer.page._onfilechooser.md)
|
|
||||||
|
|
||||||
## Page.\_onFileChooser() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_onFileChooser(event: Protocol.Page.fileChooserOpenedPayload): Promise<void>;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| event | Protocol.Page.fileChooserOpenedPayload | |
|
|
||||||
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
Promise<void>
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_pageBindings](./puppeteer.page._pagebindings.md)
|
|
||||||
|
|
||||||
## Page.\_pageBindings property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_pageBindings: Map<string, Function>;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_screenshotTaskQueue](./puppeteer.page._screenshottaskqueue.md)
|
|
||||||
|
|
||||||
## Page.\_screenshotTaskQueue property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_screenshotTaskQueue: ScreenshotTaskQueue;
|
|
||||||
```
|
|
@ -1,15 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_sessionClosePromise](./puppeteer.page._sessionclosepromise.md)
|
|
||||||
|
|
||||||
## Page.\_sessionClosePromise() method
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_sessionClosePromise(): Promise<Error>;
|
|
||||||
```
|
|
||||||
<b>Returns:</b>
|
|
||||||
|
|
||||||
Promise<Error>
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_target](./puppeteer.page._target.md)
|
|
||||||
|
|
||||||
## Page.\_target property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_target: Target;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_timeoutSettings](./puppeteer.page._timeoutsettings.md)
|
|
||||||
|
|
||||||
## Page.\_timeoutSettings property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_timeoutSettings: TimeoutSettings;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_touchscreen](./puppeteer.page._touchscreen.md)
|
|
||||||
|
|
||||||
## Page.\_touchscreen property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_touchscreen: Touchscreen;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_tracing](./puppeteer.page._tracing.md)
|
|
||||||
|
|
||||||
## Page.\_tracing property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_tracing: Tracing;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_viewport](./puppeteer.page._viewport.md)
|
|
||||||
|
|
||||||
## Page.\_viewport property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_viewport: Viewport | null;
|
|
||||||
```
|
|
@ -1,11 +0,0 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_workers](./puppeteer.page._workers.md)
|
|
||||||
|
|
||||||
## Page.\_workers property
|
|
||||||
|
|
||||||
<b>Signature:</b>
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
_workers: Map<string, WebWorker>;
|
|
||||||
```
|
|
@ -1,15 +1,15 @@
|
|||||||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||||
|
|
||||||
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [\_initialize](./puppeteer.page._initialize.md)
|
[Home](./index.md) > [puppeteer](./puppeteer.md) > [Page](./puppeteer.page.md) > [isJavaScriptEnabled](./puppeteer.page.isjavascriptenabled.md)
|
||||||
|
|
||||||
## Page.\_initialize() method
|
## Page.isJavaScriptEnabled() method
|
||||||
|
|
||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
_initialize(): Promise<void>;
|
isJavaScriptEnabled(): boolean;
|
||||||
```
|
```
|
||||||
<b>Returns:</b>
|
<b>Returns:</b>
|
||||||
|
|
||||||
Promise<void>
|
boolean
|
||||||
|
|
@ -20,25 +20,6 @@ export declare class Page extends EventEmitter
|
|||||||
|
|
||||||
| Property | Modifiers | Type | Description |
|
| Property | Modifiers | Type | Description |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- |
|
||||||
| [\_accessibility](./puppeteer.page._accessibility.md) | | [Accessibility](./puppeteer.accessibility.md) | |
|
|
||||||
| [\_client](./puppeteer.page._client.md) | | [CDPSession](./puppeteer.cdpsession.md) | |
|
|
||||||
| [\_closed](./puppeteer.page._closed.md) | | boolean | |
|
|
||||||
| [\_coverage](./puppeteer.page._coverage.md) | | [Coverage](./puppeteer.coverage.md) | |
|
|
||||||
| [\_disconnectPromise](./puppeteer.page._disconnectpromise.md) | | Promise<Error> | |
|
|
||||||
| [\_emulationManager](./puppeteer.page._emulationmanager.md) | | EmulationManager | |
|
|
||||||
| [\_fileChooserInterceptors](./puppeteer.page._filechooserinterceptors.md) | | Set<Function> | |
|
|
||||||
| [\_frameManager](./puppeteer.page._framemanager.md) | | [FrameManager](./puppeteer.framemanager.md) | |
|
|
||||||
| [\_javascriptEnabled](./puppeteer.page._javascriptenabled.md) | | boolean | |
|
|
||||||
| [\_keyboard](./puppeteer.page._keyboard.md) | | [Keyboard](./puppeteer.keyboard.md) | |
|
|
||||||
| [\_mouse](./puppeteer.page._mouse.md) | | [Mouse](./puppeteer.mouse.md) | |
|
|
||||||
| [\_pageBindings](./puppeteer.page._pagebindings.md) | | Map<string, Function> | |
|
|
||||||
| [\_screenshotTaskQueue](./puppeteer.page._screenshottaskqueue.md) | | ScreenshotTaskQueue | |
|
|
||||||
| [\_target](./puppeteer.page._target.md) | | [Target](./puppeteer.target.md) | |
|
|
||||||
| [\_timeoutSettings](./puppeteer.page._timeoutsettings.md) | | TimeoutSettings | |
|
|
||||||
| [\_touchscreen](./puppeteer.page._touchscreen.md) | | [Touchscreen](./puppeteer.touchscreen.md) | |
|
|
||||||
| [\_tracing](./puppeteer.page._tracing.md) | | [Tracing](./puppeteer.tracing.md) | |
|
|
||||||
| [\_viewport](./puppeteer.page._viewport.md) | | Viewport \| null | |
|
|
||||||
| [\_workers](./puppeteer.page._workers.md) | | Map<string, [WebWorker](./puppeteer.webworker.md)<!-- -->> | |
|
|
||||||
| [accessibility](./puppeteer.page.accessibility.md) | | [Accessibility](./puppeteer.accessibility.md) | |
|
| [accessibility](./puppeteer.page.accessibility.md) | | [Accessibility](./puppeteer.accessibility.md) | |
|
||||||
| [coverage](./puppeteer.page.coverage.md) | | [Coverage](./puppeteer.coverage.md) | |
|
| [coverage](./puppeteer.page.coverage.md) | | [Coverage](./puppeteer.coverage.md) | |
|
||||||
| [keyboard](./puppeteer.page.keyboard.md) | | [Keyboard](./puppeteer.keyboard.md) | |
|
| [keyboard](./puppeteer.page.keyboard.md) | | [Keyboard](./puppeteer.keyboard.md) | |
|
||||||
@ -50,20 +31,10 @@ export declare class Page extends EventEmitter
|
|||||||
|
|
||||||
| Method | Modifiers | Description |
|
| Method | Modifiers | Description |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| [\_addConsoleMessage(type, args, stackTrace)](./puppeteer.page._addconsolemessage.md) | | |
|
|
||||||
| [\_buildMetricsObject(metrics)](./puppeteer.page._buildmetricsobject.md) | | |
|
|
||||||
| [\_emitMetrics(event)](./puppeteer.page._emitmetrics.md) | | |
|
|
||||||
| [\_go(delta, options)](./puppeteer.page._go.md) | | |
|
| [\_go(delta, options)](./puppeteer.page._go.md) | | |
|
||||||
| [\_handleException(exceptionDetails)](./puppeteer.page._handleexception.md) | | |
|
|
||||||
| [\_initialize()](./puppeteer.page._initialize.md) | | |
|
|
||||||
| [\_onBindingCalled(event)](./puppeteer.page._onbindingcalled.md) | | |
|
|
||||||
| [\_onConsoleAPI(event)](./puppeteer.page._onconsoleapi.md) | | |
|
|
||||||
| [\_onDialog(event)](./puppeteer.page._ondialog.md) | | |
|
|
||||||
| [\_onFileChooser(event)](./puppeteer.page._onfilechooser.md) | | |
|
|
||||||
| [\_onLogEntryAdded(event)](./puppeteer.page._onlogentryadded.md) | | |
|
| [\_onLogEntryAdded(event)](./puppeteer.page._onlogentryadded.md) | | |
|
||||||
| [\_onTargetCrashed()](./puppeteer.page._ontargetcrashed.md) | | |
|
| [\_onTargetCrashed()](./puppeteer.page._ontargetcrashed.md) | | |
|
||||||
| [\_screenshotTask(format, options)](./puppeteer.page._screenshottask.md) | | |
|
| [\_screenshotTask(format, options)](./puppeteer.page._screenshottask.md) | | |
|
||||||
| [\_sessionClosePromise()](./puppeteer.page._sessionclosepromise.md) | | |
|
|
||||||
| [$(selector)](./puppeteer.page._.md) | | |
|
| [$(selector)](./puppeteer.page._.md) | | |
|
||||||
| [$$(selector)](./puppeteer.page.__.md) | | |
|
| [$$(selector)](./puppeteer.page.__.md) | | |
|
||||||
| [$$eval(selector, pageFunction, args)](./puppeteer.page.__eval.md) | | |
|
| [$$eval(selector, pageFunction, args)](./puppeteer.page.__eval.md) | | |
|
||||||
@ -97,6 +68,7 @@ export declare class Page extends EventEmitter
|
|||||||
| [goto(url, options)](./puppeteer.page.goto.md) | | |
|
| [goto(url, options)](./puppeteer.page.goto.md) | | |
|
||||||
| [hover(selector)](./puppeteer.page.hover.md) | | |
|
| [hover(selector)](./puppeteer.page.hover.md) | | |
|
||||||
| [isClosed()](./puppeteer.page.isclosed.md) | | |
|
| [isClosed()](./puppeteer.page.isclosed.md) | | |
|
||||||
|
| [isJavaScriptEnabled()](./puppeteer.page.isjavascriptenabled.md) | | |
|
||||||
| [mainFrame()](./puppeteer.page.mainframe.md) | | |
|
| [mainFrame()](./puppeteer.page.mainframe.md) | | |
|
||||||
| [metrics()](./puppeteer.page.metrics.md) | | |
|
| [metrics()](./puppeteer.page.metrics.md) | | |
|
||||||
| [pdf(options)](./puppeteer.page.pdf.md) | | |
|
| [pdf(options)](./puppeteer.page.pdf.md) | | |
|
||||||
|
@ -219,7 +219,7 @@ export class ElementHandle extends JSHandle {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
this._page._javascriptEnabled
|
this._page.isJavaScriptEnabled()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (error) throw new Error(error);
|
if (error) throw new Error(error);
|
||||||
|
66
src/Page.ts
66
src/Page.ts
@ -166,27 +166,27 @@ export class Page extends EventEmitter {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
_closed = false;
|
private _closed = false;
|
||||||
_client: CDPSession;
|
private _client: CDPSession;
|
||||||
_target: Target;
|
private _target: Target;
|
||||||
_keyboard: Keyboard;
|
private _keyboard: Keyboard;
|
||||||
_mouse: Mouse;
|
private _mouse: Mouse;
|
||||||
_timeoutSettings = new TimeoutSettings();
|
private _timeoutSettings = new TimeoutSettings();
|
||||||
_touchscreen: Touchscreen;
|
private _touchscreen: Touchscreen;
|
||||||
_accessibility: Accessibility;
|
private _accessibility: Accessibility;
|
||||||
_frameManager: FrameManager;
|
private _frameManager: FrameManager;
|
||||||
_emulationManager: EmulationManager;
|
private _emulationManager: EmulationManager;
|
||||||
_tracing: Tracing;
|
private _tracing: Tracing;
|
||||||
_pageBindings = new Map<string, Function>();
|
private _pageBindings = new Map<string, Function>();
|
||||||
_coverage: Coverage;
|
private _coverage: Coverage;
|
||||||
_javascriptEnabled = true;
|
private _javascriptEnabled = true;
|
||||||
_viewport: Viewport | null;
|
private _viewport: Viewport | null;
|
||||||
_screenshotTaskQueue: ScreenshotTaskQueue;
|
private _screenshotTaskQueue: ScreenshotTaskQueue;
|
||||||
_workers = new Map<string, WebWorker>();
|
private _workers = new Map<string, WebWorker>();
|
||||||
// TODO: improve this typedef - it's a function that takes a file chooser or something?
|
// TODO: improve this typedef - it's a function that takes a file chooser or something?
|
||||||
_fileChooserInterceptors = new Set<Function>();
|
private _fileChooserInterceptors = new Set<Function>();
|
||||||
|
|
||||||
_disconnectPromise?: Promise<Error>;
|
private _disconnectPromise?: Promise<Error>;
|
||||||
|
|
||||||
constructor(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean) {
|
constructor(client: CDPSession, target: Target, ignoreHTTPSErrors: boolean) {
|
||||||
super();
|
super();
|
||||||
@ -280,7 +280,7 @@ export class Page extends EventEmitter {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async _initialize(): Promise<void> {
|
private async _initialize(): Promise<void> {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this._frameManager.initialize(),
|
this._frameManager.initialize(),
|
||||||
this._client.send('Target.setAutoAttach', {
|
this._client.send('Target.setAutoAttach', {
|
||||||
@ -293,7 +293,7 @@ export class Page extends EventEmitter {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onFileChooser(
|
private async _onFileChooser(
|
||||||
event: Protocol.Page.fileChooserOpenedPayload
|
event: Protocol.Page.fileChooserOpenedPayload
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (!this._fileChooserInterceptors.size) return;
|
if (!this._fileChooserInterceptors.size) return;
|
||||||
@ -306,6 +306,10 @@ export class Page extends EventEmitter {
|
|||||||
for (const interceptor of interceptors) interceptor.call(null, fileChooser);
|
for (const interceptor of interceptors) interceptor.call(null, fileChooser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public isJavaScriptEnabled(): boolean {
|
||||||
|
return this._javascriptEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
async waitForFileChooser(
|
async waitForFileChooser(
|
||||||
options: { timeout?: number } = {}
|
options: { timeout?: number } = {}
|
||||||
): Promise<FileChooser> {
|
): Promise<FileChooser> {
|
||||||
@ -597,14 +601,16 @@ export class Page extends EventEmitter {
|
|||||||
return this._buildMetricsObject(response.metrics);
|
return this._buildMetricsObject(response.metrics);
|
||||||
}
|
}
|
||||||
|
|
||||||
_emitMetrics(event: Protocol.Performance.metricsPayload): void {
|
private _emitMetrics(event: Protocol.Performance.metricsPayload): void {
|
||||||
this.emit(Events.Page.Metrics, {
|
this.emit(Events.Page.Metrics, {
|
||||||
title: event.title,
|
title: event.title,
|
||||||
metrics: this._buildMetricsObject(event.metrics),
|
metrics: this._buildMetricsObject(event.metrics),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_buildMetricsObject(metrics?: Protocol.Performance.Metric[]): Metrics {
|
private _buildMetricsObject(
|
||||||
|
metrics?: Protocol.Performance.Metric[]
|
||||||
|
): Metrics {
|
||||||
const result = {};
|
const result = {};
|
||||||
for (const metric of metrics || []) {
|
for (const metric of metrics || []) {
|
||||||
if (supportedMetrics.has(metric.name)) result[metric.name] = metric.value;
|
if (supportedMetrics.has(metric.name)) result[metric.name] = metric.value;
|
||||||
@ -612,14 +618,16 @@ export class Page extends EventEmitter {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
_handleException(exceptionDetails: Protocol.Runtime.ExceptionDetails): void {
|
private _handleException(
|
||||||
|
exceptionDetails: Protocol.Runtime.ExceptionDetails
|
||||||
|
): void {
|
||||||
const message = helper.getExceptionMessage(exceptionDetails);
|
const message = helper.getExceptionMessage(exceptionDetails);
|
||||||
const err = new Error(message);
|
const err = new Error(message);
|
||||||
err.stack = ''; // Don't report clientside error with a node stack attached
|
err.stack = ''; // Don't report clientside error with a node stack attached
|
||||||
this.emit(Events.Page.PageError, err);
|
this.emit(Events.Page.PageError, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onConsoleAPI(
|
private async _onConsoleAPI(
|
||||||
event: Protocol.Runtime.consoleAPICalledPayload
|
event: Protocol.Runtime.consoleAPICalledPayload
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
if (event.executionContextId === 0) {
|
if (event.executionContextId === 0) {
|
||||||
@ -645,7 +653,7 @@ export class Page extends EventEmitter {
|
|||||||
this._addConsoleMessage(event.type, values, event.stackTrace);
|
this._addConsoleMessage(event.type, values, event.stackTrace);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onBindingCalled(
|
private async _onBindingCalled(
|
||||||
event: Protocol.Runtime.bindingCalledPayload
|
event: Protocol.Runtime.bindingCalledPayload
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { name, seq, args } = JSON.parse(event.payload);
|
const { name, seq, args } = JSON.parse(event.payload);
|
||||||
@ -704,7 +712,7 @@ export class Page extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_addConsoleMessage(
|
private _addConsoleMessage(
|
||||||
type: string,
|
type: string,
|
||||||
args: JSHandle[],
|
args: JSHandle[],
|
||||||
stackTrace?: Protocol.Runtime.StackTrace
|
stackTrace?: Protocol.Runtime.StackTrace
|
||||||
@ -736,7 +744,7 @@ export class Page extends EventEmitter {
|
|||||||
this.emit(Events.Page.Console, message);
|
this.emit(Events.Page.Console, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDialog(event: Protocol.Page.javascriptDialogOpeningPayload): void {
|
private _onDialog(event: Protocol.Page.javascriptDialogOpeningPayload): void {
|
||||||
let dialogType = null;
|
let dialogType = null;
|
||||||
const validDialogTypes = new Set<Protocol.Page.DialogType>([
|
const validDialogTypes = new Set<Protocol.Page.DialogType>([
|
||||||
'alert',
|
'alert',
|
||||||
@ -793,7 +801,7 @@ export class Page extends EventEmitter {
|
|||||||
return await this._frameManager.mainFrame().waitForNavigation(options);
|
return await this._frameManager.mainFrame().waitForNavigation(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
_sessionClosePromise(): Promise<Error> {
|
private _sessionClosePromise(): Promise<Error> {
|
||||||
if (!this._disconnectPromise)
|
if (!this._disconnectPromise)
|
||||||
this._disconnectPromise = new Promise((fulfill) =>
|
this._disconnectPromise = new Promise((fulfill) =>
|
||||||
this._client.once(Events.CDPSession.Disconnected, () =>
|
this._client.once(Events.CDPSession.Disconnected, () =>
|
||||||
|
Loading…
Reference in New Issue
Block a user