mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: add new UnsupportedOperation Error (#11322)
This commit is contained in:
parent
245f38234d
commit
0fe89b7da9
@ -42,6 +42,7 @@ sidebar_label: API
|
|||||||
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
|
| [TimeoutError](./puppeteer.timeouterror.md) | TimeoutError is emitted whenever certain operations are terminated due to timeout. |
|
||||||
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
|
| [Touchscreen](./puppeteer.touchscreen.md) | The Touchscreen class exposes touchscreen events. |
|
||||||
| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. |
|
| [Tracing](./puppeteer.tracing.md) | The Tracing class exposes the tracing audit interface. |
|
||||||
|
| [UnsupportedOperation](./puppeteer.unsupportedoperation.md) | Puppeteer will throw this error if a method is not supported by the currently used protocol |
|
||||||
| [WebWorker](./puppeteer.webworker.md) | This class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
|
| [WebWorker](./puppeteer.webworker.md) | This class represents a [WebWorker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). |
|
||||||
|
|
||||||
## Enumerations
|
## Enumerations
|
||||||
|
@ -10,7 +10,7 @@ Disconnects Puppeteer from this [browser](./puppeteer.browser.md), but leaves th
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Browser {
|
class Browser {
|
||||||
disconnect(): void;
|
abstract disconnect(): void;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Gets the associated [ChildProcess](https://nodejs.org/api/child_process.html#cla
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Browser {
|
class Browser {
|
||||||
process(): ChildProcess | null;
|
abstract process(): ChildProcess | null;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ Gets this [browser's](./puppeteer.browser.md) original user agent.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Browser {
|
class Browser {
|
||||||
userAgent(): Promise<string>;
|
abstract userAgent(): Promise<string>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Clears all permission overrides for this [browser context](./puppeteer.browserco
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class BrowserContext {
|
class BrowserContext {
|
||||||
clearPermissionOverrides(): Promise<void>;
|
abstract clearPermissionOverrides(): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,10 @@ Grants this [browser context](./puppeteer.browsercontext.md) the given `permissi
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class BrowserContext {
|
class BrowserContext {
|
||||||
overridePermissions(origin: string, permissions: Permission[]): Promise<void>;
|
abstract overridePermissions(
|
||||||
|
origin: string,
|
||||||
|
permissions: Permission[]
|
||||||
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Gets all active [targets](./puppeteer.target.md) inside this [browser context](.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class BrowserContext {
|
class BrowserContext {
|
||||||
targets(): Target[];
|
abstract targets(): Target[];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: CDPSession.connection
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class CDPSession {
|
class CDPSession {
|
||||||
connection(): Connection | undefined;
|
abstract connection(): Connection | undefined;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Detaches the cdpSession from the target. Once detached, the cdpSession object wo
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class CDPSession {
|
class CDPSession {
|
||||||
detach(): Promise<void>;
|
abstract detach(): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Returns the session's id.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class CDPSession {
|
class CDPSession {
|
||||||
id(): string;
|
abstract id(): string;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: CDPSession.send
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class CDPSession {
|
class CDPSession {
|
||||||
send<T extends keyof ProtocolMapping.Commands>(
|
abstract send<T extends keyof ProtocolMapping.Commands>(
|
||||||
method: T,
|
method: T,
|
||||||
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
||||||
): Promise<ProtocolMapping.Commands[T]['returnType']>;
|
): Promise<ProtocolMapping.Commands[T]['returnType']>;
|
||||||
|
@ -10,7 +10,7 @@ Sets the value of an [input element](https://developer.mozilla.org/en-US/docs/We
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class ElementHandle {
|
class ElementHandle {
|
||||||
uploadFile(
|
abstract uploadFile(
|
||||||
this: ElementHandle<HTMLInputElement>,
|
this: ElementHandle<HTMLInputElement>,
|
||||||
...paths: string[]
|
...paths: string[]
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
|
@ -10,7 +10,7 @@ Is `true` if the frame is an out-of-process (OOP) frame. Otherwise, `false`.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Frame {
|
class Frame {
|
||||||
isOOPFrame(): boolean;
|
abstract isOOPFrame(): boolean;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -100,7 +100,6 @@ console.log(text);
|
|||||||
| [title()](./puppeteer.frame.title.md) | | The frame's title. |
|
| [title()](./puppeteer.frame.title.md) | | The frame's title. |
|
||||||
| [type(selector, text, options)](./puppeteer.frame.type.md) | | Sends a <code>keydown</code>, <code>keypress</code>/<code>input</code>, and <code>keyup</code> event for each character in the text. |
|
| [type(selector, text, options)](./puppeteer.frame.type.md) | | Sends a <code>keydown</code>, <code>keypress</code>/<code>input</code>, and <code>keyup</code> event for each character in the text. |
|
||||||
| [url()](./puppeteer.frame.url.md) | | The frame's URL. |
|
| [url()](./puppeteer.frame.url.md) | | The frame's URL. |
|
||||||
| [waitForDevicePrompt(options)](./puppeteer.frame.waitfordeviceprompt.md) | | <p>This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth.</p><p>:::caution</p><p>This must be called before the device request is made. It will not return a currently active device prompt.</p><p>:::</p> |
|
|
||||||
| [waitForFunction(pageFunction, options, args)](./puppeteer.frame.waitforfunction.md) | | |
|
| [waitForFunction(pageFunction, options, args)](./puppeteer.frame.waitforfunction.md) | | |
|
||||||
| [waitForNavigation(options)](./puppeteer.frame.waitfornavigation.md) | | <p>Waits for the frame to navigate. It is useful for when you run code which will indirectly cause the frame to navigate.</p><p>Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.</p> |
|
| [waitForNavigation(options)](./puppeteer.frame.waitfornavigation.md) | | <p>Waits for the frame to navigate. It is useful for when you run code which will indirectly cause the frame to navigate.</p><p>Usage of the [History API](https://developer.mozilla.org/en-US/docs/Web/API/History_API) to change the URL is considered a navigation.</p> |
|
||||||
| [waitForSelector(selector, options)](./puppeteer.frame.waitforselector.md) | | <p>Waits for an element matching the given selector to appear in the frame.</p><p>This method works across navigations.</p> |
|
| [waitForSelector(selector, options)](./puppeteer.frame.waitforselector.md) | | <p>Waits for an element matching the given selector to appear in the frame.</p><p>This method works across navigations.</p> |
|
||||||
|
@ -1,45 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_label: Frame.waitForDevicePrompt
|
|
||||||
---
|
|
||||||
|
|
||||||
# Frame.waitForDevicePrompt() method
|
|
||||||
|
|
||||||
This method is typically coupled with an action that triggers a device request from an api such as WebBluetooth.
|
|
||||||
|
|
||||||
:::caution
|
|
||||||
|
|
||||||
This must be called before the device request is made. It will not return a currently active device prompt.
|
|
||||||
|
|
||||||
:::
|
|
||||||
|
|
||||||
#### Signature:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
class Frame {
|
|
||||||
waitForDevicePrompt(
|
|
||||||
options?: WaitTimeoutOptions
|
|
||||||
): Promise<DeviceRequestPrompt>;
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Parameters
|
|
||||||
|
|
||||||
| Parameter | Type | Description |
|
|
||||||
| --------- | ------------------------------------------------------- | ------------ |
|
|
||||||
| options | [WaitTimeoutOptions](./puppeteer.waittimeoutoptions.md) | _(Optional)_ |
|
|
||||||
|
|
||||||
**Returns:**
|
|
||||||
|
|
||||||
Promise<[DeviceRequestPrompt](./puppeteer.devicerequestprompt.md)>
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```ts
|
|
||||||
const [devicePrompt] = Promise.all([
|
|
||||||
frame.waitForDevicePrompt(),
|
|
||||||
frame.click('#connect-bluetooth'),
|
|
||||||
]);
|
|
||||||
await devicePrompt.select(
|
|
||||||
await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))
|
|
||||||
);
|
|
||||||
```
|
|
@ -10,7 +10,7 @@ Shortcut for `mouse.move`, `mouse.down` and `mouse.up`.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
click(
|
abstract click(
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
options?: Readonly<MouseClickOptions>
|
options?: Readonly<MouseClickOptions>
|
||||||
|
@ -10,7 +10,7 @@ Presses the mouse.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
down(options?: Readonly<MouseOptions>): Promise<void>;
|
abstract down(options?: Readonly<MouseOptions>): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Dispatches a `drag` event.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
drag(start: Point, target: Point): Promise<Protocol.Input.DragData>;
|
abstract drag(start: Point, target: Point): Promise<Protocol.Input.DragData>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Performs a drag, dragenter, dragover, and drop in sequence.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
dragAndDrop(
|
abstract dragAndDrop(
|
||||||
start: Point,
|
start: Point,
|
||||||
target: Point,
|
target: Point,
|
||||||
options?: {
|
options?: {
|
||||||
|
@ -10,7 +10,10 @@ Dispatches a `dragenter` event.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
dragEnter(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
abstract dragEnter(
|
||||||
|
target: Point,
|
||||||
|
data: Protocol.Input.DragData
|
||||||
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,10 @@ Dispatches a `dragover` event.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
dragOver(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
abstract dragOver(
|
||||||
|
target: Point,
|
||||||
|
data: Protocol.Input.DragData
|
||||||
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Performs a dragenter, dragover, and drop in sequence.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
drop(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
abstract drop(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ The Mouse class operates in main-frame CSS pixels relative to the top-left corne
|
|||||||
#### Signature:
|
#### Signature:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export declare class Mouse
|
export declare abstract class Mouse
|
||||||
```
|
```
|
||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
@ -10,7 +10,7 @@ Moves the mouse to the given coordinate.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
move(
|
abstract move(
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
options?: Readonly<MouseMoveOptions>
|
options?: Readonly<MouseMoveOptions>
|
||||||
|
@ -10,7 +10,7 @@ Resets the mouse to the default state: No buttons pressed; position at (0,0).
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
reset(): Promise<void>;
|
abstract reset(): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Releases the mouse.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
up(options?: Readonly<MouseOptions>): Promise<void>;
|
abstract up(options?: Readonly<MouseOptions>): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Dispatches a `mousewheel` event.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Mouse {
|
class Mouse {
|
||||||
wheel(options?: Readonly<MouseWheelOptions>): Promise<void>;
|
abstract wheel(options?: Readonly<MouseWheelOptions>): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Provide credentials for `HTTP authentication`.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
authenticate(credentials: Credentials): Promise<void>;
|
abstract authenticate(credentials: Credentials): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ If no URLs are specified, this method returns cookies for the current page URL.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
|
abstract cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Creates a Chrome Devtools Protocol session attached to the page.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
createCDPSession(): Promise<CDPSession>;
|
abstract createCDPSession(): Promise<CDPSession>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Generates a PDF of the page with the `print` CSS media type.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
createPDFStream(options?: PDFOptions): Promise<Readable>;
|
abstract createPDFStream(options?: PDFOptions): Promise<Readable>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Page.deleteCookie
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
deleteCookie(
|
abstract deleteCookie(
|
||||||
...cookies: Protocol.Network.DeleteCookiesRequest[]
|
...cookies: Protocol.Network.DeleteCookiesRequest[]
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ Enables CPU throttling to emulate slow CPUs.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateCPUThrottling(factor: number | null): Promise<void>;
|
abstract emulateCPUThrottling(factor: number | null): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Emulates the idle state. If no arguments set, clears idle state emulation.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateIdleState(overrides?: {
|
abstract emulateIdleState(overrides?: {
|
||||||
isUserActive: boolean;
|
isUserActive: boolean;
|
||||||
isScreenUnlocked: boolean;
|
isScreenUnlocked: boolean;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Page.emulateMediaFeatures
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
|
abstract emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Page.emulateMediaType
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateMediaType(type?: string): Promise<void>;
|
abstract emulateMediaType(type?: string): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ A list of predefined network conditions can be used by importing [PredefinedNetw
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateNetworkConditions(
|
abstract emulateNetworkConditions(
|
||||||
networkConditions: NetworkConditions | null
|
networkConditions: NetworkConditions | null
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Page.emulateTimezone
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateTimezone(timezoneId?: string): Promise<void>;
|
abstract emulateTimezone(timezoneId?: string): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Simulates the given vision deficiency on the page.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
emulateVisionDeficiency(
|
abstract emulateVisionDeficiency(
|
||||||
type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']
|
type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ This method navigate to the previous page in history.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
abstract goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ This method navigate to the next page in history.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
abstract goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ sidebar_label: Page.isDragInterceptionEnabled
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
isDragInterceptionEnabled(): boolean;
|
abstract isDragInterceptionEnabled(): boolean;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ sidebar_label: Page.isJavaScriptEnabled
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
isJavaScriptEnabled(): boolean;
|
abstract isJavaScriptEnabled(): boolean;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ sidebar_label: Page.isServiceWorkerBypassed
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
isServiceWorkerBypassed(): boolean;
|
abstract isServiceWorkerBypassed(): boolean;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Object containing metrics as key/value pairs.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
metrics(): Promise<Metrics>;
|
abstract metrics(): Promise<Metrics>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ The method removes a previously added function via $[Page.exposeFunction()](./pu
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
removeExposedFunction(name: string): Promise<void>;
|
abstract removeExposedFunction(name: string): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Toggles ignoring of service worker for each request.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setBypassServiceWorker(bypass: boolean): Promise<void>;
|
abstract setBypassServiceWorker(bypass: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Page.setCookie
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
|
abstract setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ sidebar_label: Page.setDragInterception
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setDragInterception(enabled: boolean): Promise<void>;
|
abstract setDragInterception(enabled: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ page.setExtraHTTPHeaders does not guarantee the order of headers in the outgoing
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
|
abstract setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Sets the page's geolocation.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setGeolocation(options: GeolocationOptions): Promise<void>;
|
abstract setGeolocation(options: GeolocationOptions): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Page.setJavaScriptEnabled
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setJavaScriptEnabled(enabled: boolean): Promise<void>;
|
abstract setJavaScriptEnabled(enabled: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ It does not change the parameters used in [Page.emulateNetworkConditions()](./pu
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setOfflineMode(enabled: boolean): Promise<void>;
|
abstract setOfflineMode(enabled: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ See the [Request interception guide](https://pptr.dev/next/guides/request-interc
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
setRequestInterception(value: boolean): Promise<void>;
|
abstract setRequestInterception(value: boolean): Promise<void>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ A target this page was created from.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
target(): Target;
|
abstract target(): Target;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ This must be called before the device request is made. It will not return a curr
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
waitForDevicePrompt(
|
abstract waitForDevicePrompt(
|
||||||
options?: WaitTimeoutOptions
|
options?: WaitTimeoutOptions
|
||||||
): Promise<DeviceRequestPrompt>;
|
): Promise<DeviceRequestPrompt>;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ This must be called before the file chooser is launched. It will not return a cu
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
waitForFileChooser(options?: WaitTimeoutOptions): Promise<FileChooser>;
|
abstract waitForFileChooser(
|
||||||
|
options?: WaitTimeoutOptions
|
||||||
|
): Promise<FileChooser>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ All of the dedicated [WebWorkers](https://developer.mozilla.org/en-US/docs/Web/A
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Page {
|
class Page {
|
||||||
workers(): WebWorker[];
|
abstract workers(): WebWorker[];
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Get the browser the target belongs to.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Target {
|
class Target {
|
||||||
browser(): Browser;
|
abstract browser(): Browser;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Get the browser context the target belongs to.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Target {
|
class Target {
|
||||||
browserContext(): BrowserContext;
|
abstract browserContext(): BrowserContext;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Creates a Chrome Devtools Protocol session attached to the target.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Target {
|
class Target {
|
||||||
createCDPSession(): Promise<CDPSession>;
|
abstract createCDPSession(): Promise<CDPSession>;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ Target represents a [CDP target](https://chromedevtools.github.io/devtools-proto
|
|||||||
#### Signature:
|
#### Signature:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
export declare class Target
|
export declare abstract class Target
|
||||||
```
|
```
|
||||||
|
|
||||||
## Remarks
|
## Remarks
|
||||||
|
@ -10,7 +10,7 @@ Get the target that opened this target. Top-level targets return `null`.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Target {
|
class Target {
|
||||||
opener(): Target | undefined;
|
abstract opener(): Target | undefined;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ Identifies what kind of target this is.
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Target {
|
class Target {
|
||||||
type(): TargetType;
|
abstract type(): TargetType;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ sidebar_label: Target.url
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
class Target {
|
class Target {
|
||||||
url(): string;
|
abstract url(): string;
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
15
docs/api/puppeteer.unsupportedoperation.md
Normal file
15
docs/api/puppeteer.unsupportedoperation.md
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
sidebar_label: UnsupportedOperation
|
||||||
|
---
|
||||||
|
|
||||||
|
# UnsupportedOperation class
|
||||||
|
|
||||||
|
Puppeteer will throw this error if a method is not supported by the currently used protocol
|
||||||
|
|
||||||
|
#### Signature:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
export declare class UnsupportedOperation extends CustomError
|
||||||
|
```
|
||||||
|
|
||||||
|
**Extends:** [CustomError](./puppeteer.customerror.md)
|
@ -245,20 +245,6 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
_attach(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
_detach(): void {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the associated
|
* Gets the associated
|
||||||
* {@link https://nodejs.org/api/child_process.html#class-childprocess | ChildProcess}.
|
* {@link https://nodejs.org/api/child_process.html#class-childprocess | ChildProcess}.
|
||||||
@ -266,16 +252,7 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
|
|||||||
* @returns `null` if this instance was connected to via
|
* @returns `null` if this instance was connected to via
|
||||||
* {@link Puppeteer.connect}.
|
* {@link Puppeteer.connect}.
|
||||||
*/
|
*/
|
||||||
process(): ChildProcess | null {
|
abstract process(): ChildProcess | null;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
_getIsPageTargetCallback(): IsPageTargetCallback | undefined {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new incognito {@link BrowserContext | browser context}.
|
* Creates a new incognito {@link BrowserContext | browser context}.
|
||||||
@ -316,14 +293,6 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
|
|||||||
*/
|
*/
|
||||||
abstract defaultBrowserContext(): BrowserContext;
|
abstract defaultBrowserContext(): BrowserContext;
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
_disposeContext(contextId?: string): Promise<void>;
|
|
||||||
_disposeContext(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the WebSocket URL to connect to this {@link Browser | browser}.
|
* Gets the WebSocket URL to connect to this {@link Browser | browser}.
|
||||||
*
|
*
|
||||||
@ -346,14 +315,6 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
|
|||||||
*/
|
*/
|
||||||
abstract newPage(): Promise<Page>;
|
abstract newPage(): Promise<Page>;
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
_createPageInContext(contextId?: string): Promise<Page>;
|
|
||||||
_createPageInContext(): Promise<Page> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all active {@link Target | targets}.
|
* Gets all active {@link Target | targets}.
|
||||||
*
|
*
|
||||||
@ -439,9 +400,7 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
|
|||||||
* {@link Page | Pages} can override the user agent with
|
* {@link Page | Pages} can override the user agent with
|
||||||
* {@link Page.setUserAgent}.
|
* {@link Page.setUserAgent}.
|
||||||
*/
|
*/
|
||||||
userAgent(): Promise<string> {
|
abstract userAgent(): Promise<string>;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes this {@link Browser | browser} and all associated
|
* Closes this {@link Browser | browser} and all associated
|
||||||
@ -453,9 +412,7 @@ export abstract class Browser extends EventEmitter<BrowserEvents> {
|
|||||||
* Disconnects Puppeteer from this {@link Browser | browser}, but leaves the
|
* Disconnects Puppeteer from this {@link Browser | browser}, but leaves the
|
||||||
* process running.
|
* process running.
|
||||||
*/
|
*/
|
||||||
disconnect(): void {
|
abstract disconnect(): void;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether Puppeteer is connected to this {@link Browser | browser}.
|
* Whether Puppeteer is connected to this {@link Browser | browser}.
|
||||||
|
@ -107,9 +107,7 @@ export abstract class BrowserContext extends EventEmitter<BrowserContextEvents>
|
|||||||
* Gets all active {@link Target | targets} inside this
|
* Gets all active {@link Target | targets} inside this
|
||||||
* {@link BrowserContext | browser context}.
|
* {@link BrowserContext | browser context}.
|
||||||
*/
|
*/
|
||||||
targets(): Target[] {
|
abstract targets(): Target[];
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits until a {@link Target | target} matching the given `predicate`
|
* Waits until a {@link Target | target} matching the given `predicate`
|
||||||
@ -167,10 +165,10 @@ export abstract class BrowserContext extends EventEmitter<BrowserContextEvents>
|
|||||||
* @param permissions - An array of permissions to grant. All permissions that
|
* @param permissions - An array of permissions to grant. All permissions that
|
||||||
* are not listed here will be automatically denied.
|
* are not listed here will be automatically denied.
|
||||||
*/
|
*/
|
||||||
overridePermissions(origin: string, permissions: Permission[]): Promise<void>;
|
abstract overridePermissions(
|
||||||
overridePermissions(): Promise<void> {
|
origin: string,
|
||||||
throw new Error('Not implemented');
|
permissions: Permission[]
|
||||||
}
|
): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all permission overrides for this
|
* Clears all permission overrides for this
|
||||||
@ -186,9 +184,7 @@ export abstract class BrowserContext extends EventEmitter<BrowserContextEvents>
|
|||||||
* context.clearPermissionOverrides();
|
* context.clearPermissionOverrides();
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
clearPermissionOverrides(): Promise<void> {
|
abstract clearPermissionOverrides(): Promise<void>;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link Page | page} in this
|
* Creates a new {@link Page | page} in this
|
||||||
|
@ -84,9 +84,7 @@ export abstract class CDPSession extends EventEmitter<CDPSessionEvents> {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
connection(): Connection | undefined {
|
abstract connection(): Connection | undefined;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent session in terms of CDP's auto-attach mechanism.
|
* Parent session in terms of CDP's auto-attach mechanism.
|
||||||
@ -97,28 +95,19 @@ export abstract class CDPSession extends EventEmitter<CDPSessionEvents> {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
send<T extends keyof ProtocolMapping.Commands>(
|
abstract send<T extends keyof ProtocolMapping.Commands>(
|
||||||
method: T,
|
method: T,
|
||||||
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
||||||
): Promise<ProtocolMapping.Commands[T]['returnType']>;
|
): Promise<ProtocolMapping.Commands[T]['returnType']>;
|
||||||
send<T extends keyof ProtocolMapping.Commands>(): Promise<
|
|
||||||
ProtocolMapping.Commands[T]['returnType']
|
|
||||||
> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detaches the cdpSession from the target. Once detached, the cdpSession object
|
* Detaches the cdpSession from the target. Once detached, the cdpSession object
|
||||||
* won't emit any events and can't be used to send messages.
|
* won't emit any events and can't be used to send messages.
|
||||||
*/
|
*/
|
||||||
async detach(): Promise<void> {
|
abstract detach(): Promise<void>;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the session's id.
|
* Returns the session's id.
|
||||||
*/
|
*/
|
||||||
id(): string {
|
abstract id(): string;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -962,14 +962,12 @@ export abstract class ElementHandle<
|
|||||||
* {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}.
|
* {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}.
|
||||||
* For locals script connecting to remote chrome environments, paths must be
|
* For locals script connecting to remote chrome environments, paths must be
|
||||||
* absolute.
|
* absolute.
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
async uploadFile(
|
abstract uploadFile(
|
||||||
this: ElementHandle<HTMLInputElement>,
|
this: ElementHandle<HTMLInputElement>,
|
||||||
...paths: string[]
|
...paths: string[]
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
async uploadFile(this: ElementHandle<HTMLInputElement>): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method scrolls element into view if needed, and then uses
|
* This method scrolls element into view if needed, and then uses
|
||||||
|
@ -312,9 +312,7 @@ export abstract class Frame extends EventEmitter<FrameEvents> {
|
|||||||
* Is `true` if the frame is an out-of-process (OOP) frame. Otherwise,
|
* Is `true` if the frame is an out-of-process (OOP) frame. Otherwise,
|
||||||
* `false`.
|
* `false`.
|
||||||
*/
|
*/
|
||||||
isOOPFrame(): boolean {
|
abstract isOOPFrame(): boolean;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigates the frame to the given `url`.
|
* Navigates the frame to the given `url`.
|
||||||
@ -1197,26 +1195,10 @@ export abstract class Frame extends EventEmitter<FrameEvents> {
|
|||||||
* await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))
|
* await devicePrompt.waitForDevice(({name}) => name.includes('My Device'))
|
||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
|
*
|
||||||
|
* @internal
|
||||||
*/
|
*/
|
||||||
waitForDevicePrompt(
|
abstract waitForDevicePrompt(
|
||||||
options?: WaitTimeoutOptions
|
options?: WaitTimeoutOptions
|
||||||
): Promise<DeviceRequestPrompt>;
|
): Promise<DeviceRequestPrompt>;
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
waitForDevicePrompt(): Promise<DeviceRequestPrompt> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
exposeFunction<Args extends unknown[], Ret>(
|
|
||||||
name: string,
|
|
||||||
fn: (...args: Args) => Awaitable<Ret>
|
|
||||||
): Promise<void>;
|
|
||||||
exposeFunction(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -355,7 +355,7 @@ export type MouseButton = (typeof MouseButton)[keyof typeof MouseButton];
|
|||||||
*
|
*
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export class Mouse {
|
export abstract class Mouse {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
@ -365,9 +365,7 @@ export class Mouse {
|
|||||||
* Resets the mouse to the default state: No buttons pressed; position at
|
* Resets the mouse to the default state: No buttons pressed; position at
|
||||||
* (0,0).
|
* (0,0).
|
||||||
*/
|
*/
|
||||||
async reset(): Promise<void> {
|
abstract reset(): Promise<void>;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves the mouse to the given coordinate.
|
* Moves the mouse to the given coordinate.
|
||||||
@ -376,34 +374,25 @@ export class Mouse {
|
|||||||
* @param y - Vertical position of the mouse.
|
* @param y - Vertical position of the mouse.
|
||||||
* @param options - Options to configure behavior.
|
* @param options - Options to configure behavior.
|
||||||
*/
|
*/
|
||||||
async move(
|
abstract move(
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
options?: Readonly<MouseMoveOptions>
|
options?: Readonly<MouseMoveOptions>
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
async move(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Presses the mouse.
|
* Presses the mouse.
|
||||||
*
|
*
|
||||||
* @param options - Options to configure behavior.
|
* @param options - Options to configure behavior.
|
||||||
*/
|
*/
|
||||||
async down(options?: Readonly<MouseOptions>): Promise<void>;
|
abstract down(options?: Readonly<MouseOptions>): Promise<void>;
|
||||||
async down(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases the mouse.
|
* Releases the mouse.
|
||||||
*
|
*
|
||||||
* @param options - Options to configure behavior.
|
* @param options - Options to configure behavior.
|
||||||
*/
|
*/
|
||||||
async up(options?: Readonly<MouseOptions>): Promise<void>;
|
abstract up(options?: Readonly<MouseOptions>): Promise<void>;
|
||||||
async up(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shortcut for `mouse.move`, `mouse.down` and `mouse.up`.
|
* Shortcut for `mouse.move`, `mouse.down` and `mouse.up`.
|
||||||
@ -412,14 +401,11 @@ export class Mouse {
|
|||||||
* @param y - Vertical position of the mouse.
|
* @param y - Vertical position of the mouse.
|
||||||
* @param options - Options to configure behavior.
|
* @param options - Options to configure behavior.
|
||||||
*/
|
*/
|
||||||
async click(
|
abstract click(
|
||||||
x: number,
|
x: number,
|
||||||
y: number,
|
y: number,
|
||||||
options?: Readonly<MouseClickOptions>
|
options?: Readonly<MouseClickOptions>
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
async click(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches a `mousewheel` event.
|
* Dispatches a `mousewheel` event.
|
||||||
@ -443,50 +429,41 @@ export class Mouse {
|
|||||||
* await page.mouse.wheel({deltaY: -100});
|
* await page.mouse.wheel({deltaY: -100});
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
async wheel(options?: Readonly<MouseWheelOptions>): Promise<void>;
|
abstract wheel(options?: Readonly<MouseWheelOptions>): Promise<void>;
|
||||||
async wheel(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches a `drag` event.
|
* Dispatches a `drag` event.
|
||||||
* @param start - starting point for drag
|
* @param start - starting point for drag
|
||||||
* @param target - point to drag to
|
* @param target - point to drag to
|
||||||
*/
|
*/
|
||||||
async drag(start: Point, target: Point): Promise<Protocol.Input.DragData>;
|
abstract drag(start: Point, target: Point): Promise<Protocol.Input.DragData>;
|
||||||
async drag(): Promise<Protocol.Input.DragData> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches a `dragenter` event.
|
* Dispatches a `dragenter` event.
|
||||||
* @param target - point for emitting `dragenter` event
|
* @param target - point for emitting `dragenter` event
|
||||||
* @param data - drag data containing items and operations mask
|
* @param data - drag data containing items and operations mask
|
||||||
*/
|
*/
|
||||||
async dragEnter(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
abstract dragEnter(
|
||||||
async dragEnter(): Promise<void> {
|
target: Point,
|
||||||
throw new Error('Not implemented');
|
data: Protocol.Input.DragData
|
||||||
}
|
): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispatches a `dragover` event.
|
* Dispatches a `dragover` event.
|
||||||
* @param target - point for emitting `dragover` event
|
* @param target - point for emitting `dragover` event
|
||||||
* @param data - drag data containing items and operations mask
|
* @param data - drag data containing items and operations mask
|
||||||
*/
|
*/
|
||||||
async dragOver(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
abstract dragOver(
|
||||||
async dragOver(): Promise<void> {
|
target: Point,
|
||||||
throw new Error('Not implemented');
|
data: Protocol.Input.DragData
|
||||||
}
|
): Promise<void>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a dragenter, dragover, and drop in sequence.
|
* Performs a dragenter, dragover, and drop in sequence.
|
||||||
* @param target - point to drop on
|
* @param target - point to drop on
|
||||||
* @param data - drag data containing items and operations mask
|
* @param data - drag data containing items and operations mask
|
||||||
*/
|
*/
|
||||||
async drop(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
abstract drop(target: Point, data: Protocol.Input.DragData): Promise<void>;
|
||||||
async drop(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a drag, dragenter, dragover, and drop in sequence.
|
* Performs a drag, dragenter, dragover, and drop in sequence.
|
||||||
@ -496,14 +473,11 @@ export class Mouse {
|
|||||||
* if specified, is the time to wait between `dragover` and `drop` in milliseconds.
|
* if specified, is the time to wait between `dragover` and `drop` in milliseconds.
|
||||||
* Defaults to 0.
|
* Defaults to 0.
|
||||||
*/
|
*/
|
||||||
async dragAndDrop(
|
abstract dragAndDrop(
|
||||||
start: Point,
|
start: Point,
|
||||||
target: Point,
|
target: Point,
|
||||||
options?: {delay?: number}
|
options?: {delay?: number}
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
async dragAndDrop(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -67,9 +67,7 @@ export abstract class JSHandle<T = unknown> {
|
|||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
get disposed(): boolean {
|
abstract get disposed(): boolean;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Evaluates the given function with the current handle as its first argument.
|
* Evaluates the given function with the current handle as its first argument.
|
||||||
|
@ -620,9 +620,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
/**
|
/**
|
||||||
* `true` if the service worker are being bypassed, `false` otherwise.
|
* `true` if the service worker are being bypassed, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
isServiceWorkerBypassed(): boolean {
|
abstract isServiceWorkerBypassed(): boolean;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `true` if drag events are being intercepted, `false` otherwise.
|
* `true` if drag events are being intercepted, `false` otherwise.
|
||||||
@ -631,16 +629,12 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* drag APIs found on {@link ElementHandle} to drag (or just use the
|
* drag APIs found on {@link ElementHandle} to drag (or just use the
|
||||||
* {@link Page.mouse}).
|
* {@link Page.mouse}).
|
||||||
*/
|
*/
|
||||||
isDragInterceptionEnabled(): boolean {
|
abstract isDragInterceptionEnabled(): boolean;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `true` if the page has JavaScript enabled, `false` otherwise.
|
* `true` if the page has JavaScript enabled, `false` otherwise.
|
||||||
*/
|
*/
|
||||||
isJavaScriptEnabled(): boolean {
|
abstract isJavaScriptEnabled(): boolean;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen to page events.
|
* Listen to page events.
|
||||||
@ -725,10 +719,9 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* await fileChooser.accept(['/tmp/myfile.pdf']);
|
* await fileChooser.accept(['/tmp/myfile.pdf']);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
waitForFileChooser(options?: WaitTimeoutOptions): Promise<FileChooser>;
|
abstract waitForFileChooser(
|
||||||
waitForFileChooser(): Promise<FileChooser> {
|
options?: WaitTimeoutOptions
|
||||||
throw new Error('Not implemented');
|
): Promise<FileChooser>;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the page's geolocation.
|
* Sets the page's geolocation.
|
||||||
@ -743,17 +736,12 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
|
* await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
async setGeolocation(options: GeolocationOptions): Promise<void>;
|
abstract setGeolocation(options: GeolocationOptions): Promise<void>;
|
||||||
async setGeolocation(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A target this page was created from.
|
* A target this page was created from.
|
||||||
*/
|
*/
|
||||||
target(): Target {
|
abstract target(): Target;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the browser the page belongs to.
|
* Get the browser the page belongs to.
|
||||||
@ -776,9 +764,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
/**
|
/**
|
||||||
* Creates a Chrome Devtools Protocol session attached to the page.
|
* Creates a Chrome Devtools Protocol session attached to the page.
|
||||||
*/
|
*/
|
||||||
createCDPSession(): Promise<CDPSession> {
|
abstract createCDPSession(): Promise<CDPSession>;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc Keyboard}
|
* {@inheritDoc Keyboard}
|
||||||
@ -788,9 +774,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc Touchscreen}
|
* {@inheritDoc Touchscreen}
|
||||||
*/
|
*/
|
||||||
get touchscreen(): Touchscreen {
|
abstract get touchscreen(): Touchscreen;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc Coverage}
|
* {@inheritDoc Coverage}
|
||||||
@ -820,9 +804,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* @remarks
|
* @remarks
|
||||||
* This does not contain ServiceWorkers
|
* This does not contain ServiceWorkers
|
||||||
*/
|
*/
|
||||||
workers(): WebWorker[] {
|
abstract workers(): WebWorker[];
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activating request interception enables {@link HTTPRequest.abort},
|
* Activating request interception enables {@link HTTPRequest.abort},
|
||||||
@ -860,20 +842,14 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
*
|
*
|
||||||
* @param value - Whether to enable request interception.
|
* @param value - Whether to enable request interception.
|
||||||
*/
|
*/
|
||||||
async setRequestInterception(value: boolean): Promise<void>;
|
abstract setRequestInterception(value: boolean): Promise<void>;
|
||||||
async setRequestInterception(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles ignoring of service worker for each request.
|
* Toggles ignoring of service worker for each request.
|
||||||
*
|
*
|
||||||
* @param bypass - Whether to bypass service worker and load from network.
|
* @param bypass - Whether to bypass service worker and load from network.
|
||||||
*/
|
*/
|
||||||
async setBypassServiceWorker(bypass: boolean): Promise<void>;
|
abstract setBypassServiceWorker(bypass: boolean): Promise<void>;
|
||||||
async setBypassServiceWorker(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param enabled - Whether to enable drag interception.
|
* @param enabled - Whether to enable drag interception.
|
||||||
@ -882,10 +858,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* drag APIs found on {@link ElementHandle} to drag (or just use the
|
* drag APIs found on {@link ElementHandle} to drag (or just use the
|
||||||
* {@link Page.mouse}).
|
* {@link Page.mouse}).
|
||||||
*/
|
*/
|
||||||
async setDragInterception(enabled: boolean): Promise<void>;
|
abstract setDragInterception(enabled: boolean): Promise<void>;
|
||||||
async setDragInterception(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the network connection to offline.
|
* Sets the network connection to offline.
|
||||||
@ -894,10 +867,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
*
|
*
|
||||||
* @param enabled - When `true`, enables offline mode for the page.
|
* @param enabled - When `true`, enables offline mode for the page.
|
||||||
*/
|
*/
|
||||||
setOfflineMode(enabled: boolean): Promise<void>;
|
abstract setOfflineMode(enabled: boolean): Promise<void>;
|
||||||
setOfflineMode(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This does not affect WebSockets and WebRTC PeerConnections (see
|
* This does not affect WebSockets and WebRTC PeerConnections (see
|
||||||
@ -926,12 +896,9 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* @param networkConditions - Passing `null` disables network condition
|
* @param networkConditions - Passing `null` disables network condition
|
||||||
* emulation.
|
* emulation.
|
||||||
*/
|
*/
|
||||||
emulateNetworkConditions(
|
abstract emulateNetworkConditions(
|
||||||
networkConditions: NetworkConditions | null
|
networkConditions: NetworkConditions | null
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
emulateNetworkConditions(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This setting will change the default maximum navigation time for the
|
* This setting will change the default maximum navigation time for the
|
||||||
@ -1303,17 +1270,11 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* If no URLs are specified, this method returns cookies for the current page
|
* If no URLs are specified, this method returns cookies for the current page
|
||||||
* URL. If URLs are specified, only cookies for those URLs are returned.
|
* URL. If URLs are specified, only cookies for those URLs are returned.
|
||||||
*/
|
*/
|
||||||
async cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
|
abstract cookies(...urls: string[]): Promise<Protocol.Network.Cookie[]>;
|
||||||
async cookies(): Promise<Protocol.Network.Cookie[]> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
async deleteCookie(
|
abstract deleteCookie(
|
||||||
...cookies: Protocol.Network.DeleteCookiesRequest[]
|
...cookies: Protocol.Network.DeleteCookiesRequest[]
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
async deleteCookie(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @example
|
* @example
|
||||||
@ -1322,10 +1283,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* await page.setCookie(cookieObject1, cookieObject2);
|
* await page.setCookie(cookieObject1, cookieObject2);
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
async setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
|
abstract setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
|
||||||
async setCookie(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a `<script>` tag into the page with the desired URL or content.
|
* Adds a `<script>` tag into the page with the desired URL or content.
|
||||||
@ -1445,10 +1403,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* The method removes a previously added function via ${@link Page.exposeFunction}
|
* The method removes a previously added function via ${@link Page.exposeFunction}
|
||||||
* called `name` from the page's `window` object.
|
* called `name` from the page's `window` object.
|
||||||
*/
|
*/
|
||||||
async removeExposedFunction(name: string): Promise<void>;
|
abstract removeExposedFunction(name: string): Promise<void>;
|
||||||
async removeExposedFunction(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide credentials for `HTTP authentication`.
|
* Provide credentials for `HTTP authentication`.
|
||||||
@ -1456,10 +1411,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* @remarks
|
* @remarks
|
||||||
* To disable authentication, pass `null`.
|
* To disable authentication, pass `null`.
|
||||||
*/
|
*/
|
||||||
async authenticate(credentials: Credentials): Promise<void>;
|
abstract authenticate(credentials: Credentials): Promise<void>;
|
||||||
async authenticate(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The extra HTTP headers will be sent with every request the page initiates.
|
* The extra HTTP headers will be sent with every request the page initiates.
|
||||||
@ -1481,10 +1433,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* @param headers - An object containing additional HTTP headers to be sent
|
* @param headers - An object containing additional HTTP headers to be sent
|
||||||
* with every request. All header values must be strings.
|
* with every request. All header values must be strings.
|
||||||
*/
|
*/
|
||||||
async setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
|
abstract setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
|
||||||
async setExtraHTTPHeaders(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param userAgent - Specific user agent to use in this page
|
* @param userAgent - Specific user agent to use in this page
|
||||||
@ -1533,9 +1482,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* All timestamps are in monotonic time: monotonically increasing time
|
* All timestamps are in monotonic time: monotonically increasing time
|
||||||
* in seconds since an arbitrary point in the past.
|
* in seconds since an arbitrary point in the past.
|
||||||
*/
|
*/
|
||||||
async metrics(): Promise<Metrics> {
|
abstract metrics(): Promise<Metrics>;
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The page's URL.
|
* The page's URL.
|
||||||
@ -1838,10 +1785,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* - `networkidle2` : consider navigation to be finished when there are no
|
* - `networkidle2` : consider navigation to be finished when there are no
|
||||||
* more than 2 network connections for at least `500` ms.
|
* more than 2 network connections for at least `500` ms.
|
||||||
*/
|
*/
|
||||||
async goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
abstract goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
||||||
async goBack(): Promise<HTTPResponse | null> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method navigate to the next page in history.
|
* This method navigate to the next page in history.
|
||||||
@ -1869,10 +1813,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* - `networkidle2` : consider navigation to be finished when there are no
|
* - `networkidle2` : consider navigation to be finished when there are no
|
||||||
* more than 2 network connections for at least `500` ms.
|
* more than 2 network connections for at least `500` ms.
|
||||||
*/
|
*/
|
||||||
async goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
abstract goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
||||||
async goForward(): Promise<HTTPResponse | null> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Brings page to front (activates tab).
|
* Brings page to front (activates tab).
|
||||||
@ -1922,10 +1863,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* NOTE: changing this value won't affect scripts that have already been run.
|
* NOTE: changing this value won't affect scripts that have already been run.
|
||||||
* It will take full effect on the next navigation.
|
* It will take full effect on the next navigation.
|
||||||
*/
|
*/
|
||||||
async setJavaScriptEnabled(enabled: boolean): Promise<void>;
|
abstract setJavaScriptEnabled(enabled: boolean): Promise<void>;
|
||||||
async setJavaScriptEnabled(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles bypassing page's Content-Security-Policy.
|
* Toggles bypassing page's Content-Security-Policy.
|
||||||
@ -1962,19 +1900,13 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* // → false
|
* // → false
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
async emulateMediaType(type?: string): Promise<void>;
|
abstract emulateMediaType(type?: string): Promise<void>;
|
||||||
async emulateMediaType(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables CPU throttling to emulate slow CPUs.
|
* Enables CPU throttling to emulate slow CPUs.
|
||||||
* @param factor - slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
|
* @param factor - slowdown factor (1 is no throttle, 2 is 2x slowdown, etc).
|
||||||
*/
|
*/
|
||||||
async emulateCPUThrottling(factor: number | null): Promise<void>;
|
abstract emulateCPUThrottling(factor: number | null): Promise<void>;
|
||||||
async emulateCPUThrottling(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param features - `<?Array<Object>>` Given an array of media feature
|
* @param features - `<?Array<Object>>` Given an array of media feature
|
||||||
@ -2037,10 +1969,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* // → false
|
* // → false
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
async emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
|
abstract emulateMediaFeatures(features?: MediaFeature[]): Promise<void>;
|
||||||
async emulateMediaFeatures(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param timezoneId - Changes the timezone of the page. See
|
* @param timezoneId - Changes the timezone of the page. See
|
||||||
@ -2048,10 +1977,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* for a list of supported timezone IDs. Passing
|
* for a list of supported timezone IDs. Passing
|
||||||
* `null` disables timezone emulation.
|
* `null` disables timezone emulation.
|
||||||
*/
|
*/
|
||||||
async emulateTimezone(timezoneId?: string): Promise<void>;
|
abstract emulateTimezone(timezoneId?: string): Promise<void>;
|
||||||
async emulateTimezone(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Emulates the idle state.
|
* Emulates the idle state.
|
||||||
@ -2072,13 +1998,10 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
*
|
*
|
||||||
* @param overrides - Mock idle state. If not set, clears idle overrides
|
* @param overrides - Mock idle state. If not set, clears idle overrides
|
||||||
*/
|
*/
|
||||||
async emulateIdleState(overrides?: {
|
abstract emulateIdleState(overrides?: {
|
||||||
isUserActive: boolean;
|
isUserActive: boolean;
|
||||||
isScreenUnlocked: boolean;
|
isScreenUnlocked: boolean;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
async emulateIdleState(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simulates the given vision deficiency on the page.
|
* Simulates the given vision deficiency on the page.
|
||||||
@ -2108,12 +2031,9 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
*
|
*
|
||||||
* @param type - the type of deficiency to simulate, or `'none'` to reset.
|
* @param type - the type of deficiency to simulate, or `'none'` to reset.
|
||||||
*/
|
*/
|
||||||
async emulateVisionDeficiency(
|
abstract emulateVisionDeficiency(
|
||||||
type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']
|
type?: Protocol.Emulation.SetEmulatedVisionDeficiencyRequest['type']
|
||||||
): Promise<void>;
|
): Promise<void>;
|
||||||
async emulateVisionDeficiency(): Promise<void> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* `page.setViewport` will resize the page. A lot of websites don't expect
|
* `page.setViewport` will resize the page. A lot of websites don't expect
|
||||||
@ -2734,10 +2654,7 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
*
|
*
|
||||||
* @param options - options for generating the PDF.
|
* @param options - options for generating the PDF.
|
||||||
*/
|
*/
|
||||||
async createPDFStream(options?: PDFOptions): Promise<Readable>;
|
abstract createPDFStream(options?: PDFOptions): Promise<Readable>;
|
||||||
async createPDFStream(): Promise<Readable> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc Page.createPDFStream}
|
* {@inheritDoc Page.createPDFStream}
|
||||||
@ -3139,12 +3056,9 @@ export abstract class Page extends EventEmitter<PageEvents> {
|
|||||||
* );
|
* );
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
waitForDevicePrompt(
|
abstract waitForDevicePrompt(
|
||||||
options?: WaitTimeoutOptions
|
options?: WaitTimeoutOptions
|
||||||
): Promise<DeviceRequestPrompt>;
|
): Promise<DeviceRequestPrompt>;
|
||||||
waitForDevicePrompt(): Promise<DeviceRequestPrompt> {
|
|
||||||
throw new Error('Not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @internal */
|
/** @internal */
|
||||||
[disposeSymbol](): void {
|
[disposeSymbol](): void {
|
||||||
|
@ -45,7 +45,7 @@ export enum TargetType {
|
|||||||
* worker.
|
* worker.
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export class Target {
|
export abstract class Target {
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
@ -66,16 +66,12 @@ export class Target {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
url(): string {
|
abstract url(): string;
|
||||||
throw new Error('not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Chrome Devtools Protocol session attached to the target.
|
* Creates a Chrome Devtools Protocol session attached to the target.
|
||||||
*/
|
*/
|
||||||
createCDPSession(): Promise<CDPSession> {
|
abstract createCDPSession(): Promise<CDPSession>;
|
||||||
throw new Error('not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Identifies what kind of target this is.
|
* Identifies what kind of target this is.
|
||||||
@ -84,28 +80,20 @@ export class Target {
|
|||||||
*
|
*
|
||||||
* See {@link https://developer.chrome.com/extensions/background_pages | docs} for more info about background pages.
|
* See {@link https://developer.chrome.com/extensions/background_pages | docs} for more info about background pages.
|
||||||
*/
|
*/
|
||||||
type(): TargetType {
|
abstract type(): TargetType;
|
||||||
throw new Error('not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the browser the target belongs to.
|
* Get the browser the target belongs to.
|
||||||
*/
|
*/
|
||||||
browser(): Browser {
|
abstract browser(): Browser;
|
||||||
throw new Error('not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the browser context the target belongs to.
|
* Get the browser context the target belongs to.
|
||||||
*/
|
*/
|
||||||
browserContext(): BrowserContext {
|
abstract browserContext(): BrowserContext;
|
||||||
throw new Error('not implemented');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the target that opened this target. Top-level targets return `null`.
|
* Get the target that opened this target. Top-level targets return `null`.
|
||||||
*/
|
*/
|
||||||
opener(): Target | undefined {
|
abstract opener(): Target | undefined;
|
||||||
throw new Error('not implemented');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import {
|
|||||||
import {BrowserContextEvent} from '../api/BrowserContext.js';
|
import {BrowserContextEvent} from '../api/BrowserContext.js';
|
||||||
import type {Page} from '../api/Page.js';
|
import type {Page} from '../api/Page.js';
|
||||||
import type {Target} from '../api/Target.js';
|
import type {Target} from '../api/Target.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {Handler} from '../common/EventEmitter.js';
|
import type {Handler} from '../common/EventEmitter.js';
|
||||||
import {debugError} from '../common/util.js';
|
import {debugError} from '../common/util.js';
|
||||||
import type {Viewport} from '../common/Viewport.js';
|
import type {Viewport} from '../common/Viewport.js';
|
||||||
@ -165,6 +166,10 @@ export class BidiBrowser extends Browser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override userAgent(): Promise<string> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
#onContextDomLoaded(event: Bidi.BrowsingContext.Info) {
|
#onContextDomLoaded(event: Bidi.BrowsingContext.Info) {
|
||||||
const target = this.#targets.get(event.context);
|
const target = this.#targets.get(event.context);
|
||||||
if (target) {
|
if (target) {
|
||||||
@ -315,4 +320,8 @@ export class BidiBrowser extends Browser {
|
|||||||
override target(): Target {
|
override target(): Target {
|
||||||
return this.#browserTarget;
|
return this.#browserTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override disconnect(): void {
|
||||||
|
this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import type {WaitForTargetOptions} from '../api/Browser.js';
|
|||||||
import {BrowserContext} from '../api/BrowserContext.js';
|
import {BrowserContext} from '../api/BrowserContext.js';
|
||||||
import type {Page} from '../api/Page.js';
|
import type {Page} from '../api/Page.js';
|
||||||
import type {Target} from '../api/Target.js';
|
import type {Target} from '../api/Target.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {Viewport} from '../common/Viewport.js';
|
import type {Viewport} from '../common/Viewport.js';
|
||||||
|
|
||||||
import type {BidiBrowser} from './Browser.js';
|
import type {BidiBrowser} from './Browser.js';
|
||||||
@ -124,4 +125,12 @@ export class BidiBrowserContext extends BrowserContext {
|
|||||||
override isIncognito(): boolean {
|
override isIncognito(): boolean {
|
||||||
return !this.#isDefault;
|
return !this.#isDefault;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override overridePermissions(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override clearPermissionOverrides(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
|||||||
|
|
||||||
import {CDPSession} from '../api/CDPSession.js';
|
import {CDPSession} from '../api/CDPSession.js';
|
||||||
import type {Connection as CdpConnection} from '../cdp/Connection.js';
|
import type {Connection as CdpConnection} from '../cdp/Connection.js';
|
||||||
import {TargetCloseError} from '../common/Errors.js';
|
import {TargetCloseError, UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {EventType} from '../common/EventEmitter.js';
|
import type {EventType} from '../common/EventEmitter.js';
|
||||||
import {debugError} from '../common/util.js';
|
import {debugError} from '../common/util.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
@ -57,7 +57,7 @@ export class CdpSessionWrapper extends CDPSession {
|
|||||||
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
...paramArgs: ProtocolMapping.Commands[T]['paramsType']
|
||||||
): Promise<ProtocolMapping.Commands[T]['returnType']> {
|
): Promise<ProtocolMapping.Commands[T]['returnType']> {
|
||||||
if (!this.#context.supportsCdp()) {
|
if (!this.#context.supportsCdp()) {
|
||||||
throw new Error(
|
throw new UnsupportedOperation(
|
||||||
'CDP support is required for this feature. The current browser does not support CDP.'
|
'CDP support is required for this feature. The current browser does not support CDP.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
|
|
||||||
import {type AutofillData, ElementHandle} from '../api/ElementHandle.js';
|
import {type AutofillData, ElementHandle} from '../api/ElementHandle.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import {throwIfDisposed} from '../util/decorators.js';
|
import {throwIfDisposed} from '../util/decorators.js';
|
||||||
|
|
||||||
import type {BidiFrame} from './Frame.js';
|
import type {BidiFrame} from './Frame.js';
|
||||||
@ -89,4 +90,8 @@ export class BidiElementHandle<
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override uploadFile(this: ElementHandle<HTMLInputElement>): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,9 +34,11 @@ import {
|
|||||||
type WaitForOptions,
|
type WaitForOptions,
|
||||||
throwIfDetached,
|
throwIfDetached,
|
||||||
} from '../api/Frame.js';
|
} from '../api/Frame.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
|
import type {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
import type {Awaitable} from '../common/types.js';
|
import type {Awaitable} from '../common/types.js';
|
||||||
import {UTILITY_WORLD_NAME, setPageContent, timeout} from '../common/util.js';
|
import {UTILITY_WORLD_NAME, setPageContent, timeout} from '../common/util.js';
|
||||||
|
import type {DeviceRequestPrompt} from '../puppeteer-core.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
import {disposeSymbol} from '../util/disposable.js';
|
import {disposeSymbol} from '../util/disposable.js';
|
||||||
|
|
||||||
@ -109,6 +111,10 @@ export class BidiFrame extends Frame {
|
|||||||
return this.#page;
|
return this.#page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override isOOPFrame(): boolean {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
override url(): string {
|
override url(): string {
|
||||||
return this.#context.url;
|
return this.#context.url;
|
||||||
}
|
}
|
||||||
@ -227,6 +233,10 @@ export class BidiFrame extends Frame {
|
|||||||
return this.#page.getNavigationResponse(response?.result.navigation);
|
return this.#page.getNavigationResponse(response?.result.navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override waitForDevicePrompt(): Promise<DeviceRequestPrompt> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
override get detached(): boolean {
|
override get detached(): boolean {
|
||||||
return this.#disposed;
|
return this.#disposed;
|
||||||
}
|
}
|
||||||
@ -243,7 +253,7 @@ export class BidiFrame extends Frame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#exposedFunctions = new Map<string, ExposeableFunction<never[], unknown>>();
|
#exposedFunctions = new Map<string, ExposeableFunction<never[], unknown>>();
|
||||||
override async exposeFunction<Args extends unknown[], Ret>(
|
async exposeFunction<Args extends unknown[], Ret>(
|
||||||
name: string,
|
name: string,
|
||||||
apply: (...args: Args) => Awaitable<Ret>
|
apply: (...args: Args) => Awaitable<Ret>
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
import type {Protocol} from 'devtools-protocol';
|
import type {Protocol} from 'devtools-protocol';
|
||||||
|
|
||||||
|
import type {CDPSession} from '../api/CDPSession.js';
|
||||||
import type {Frame} from '../api/Frame.js';
|
import type {Frame} from '../api/Frame.js';
|
||||||
import type {
|
import type {
|
||||||
ContinueRequestOverrides,
|
ContinueRequestOverrides,
|
||||||
@ -23,7 +24,7 @@ import type {
|
|||||||
ResponseForRequest,
|
ResponseForRequest,
|
||||||
} from '../api/HTTPRequest.js';
|
} from '../api/HTTPRequest.js';
|
||||||
import {HTTPRequest, type ResourceType} from '../api/HTTPRequest.js';
|
import {HTTPRequest, type ResourceType} from '../api/HTTPRequest.js';
|
||||||
import type {CDPSession} from '../puppeteer-core.js';
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
|
|
||||||
import type {BidiHTTPResponse} from './HTTPResponse.js';
|
import type {BidiHTTPResponse} from './HTTPResponse.js';
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override get client(): CDPSession {
|
override get client(): CDPSession {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override url(): string {
|
override url(): string {
|
||||||
@ -123,47 +124,47 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override continueRequestOverrides(): ContinueRequestOverrides {
|
override continueRequestOverrides(): ContinueRequestOverrides {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override async continue(
|
override async continue(
|
||||||
_overrides: ContinueRequestOverrides = {}
|
_overrides: ContinueRequestOverrides = {}
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override responseForRequest(): Partial<ResponseForRequest> {
|
override responseForRequest(): Partial<ResponseForRequest> {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override abortErrorReason(): Protocol.Network.ErrorReason | null {
|
override abortErrorReason(): Protocol.Network.ErrorReason | null {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override interceptResolutionState(): InterceptResolutionState {
|
override interceptResolutionState(): InterceptResolutionState {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override isInterceptResolutionHandled(): boolean {
|
override isInterceptResolutionHandled(): boolean {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override async finalizeInterceptions(): Promise<void> {
|
override async finalizeInterceptions(): Promise<void> {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override abort(): Promise<void> {
|
override abort(): Promise<void> {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override respond(
|
override respond(
|
||||||
_response: Partial<ResponseForRequest>,
|
_response: Partial<ResponseForRequest>,
|
||||||
_priority?: number
|
_priority?: number
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override failure(): {errorText: string} | null {
|
override failure(): {errorText: string} | null {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
HTTPResponse as HTTPResponse,
|
HTTPResponse as HTTPResponse,
|
||||||
type RemoteAddress,
|
type RemoteAddress,
|
||||||
} from '../api/HTTPResponse.js';
|
} from '../api/HTTPResponse.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {SecurityDetails} from '../common/SecurityDetails.js';
|
import type {SecurityDetails} from '../common/SecurityDetails.js';
|
||||||
|
|
||||||
import type {BidiHTTPRequest} from './HTTPRequest.js';
|
import type {BidiHTTPRequest} from './HTTPRequest.js';
|
||||||
@ -108,10 +109,10 @@ export class BidiHTTPResponse extends HTTPResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override securityDetails(): SecurityDetails | null {
|
override securityDetails(): SecurityDetails | null {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
override buffer(): Promise<Buffer> {
|
override buffer(): Promise<Buffer> {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
|
import type Protocol from 'devtools-protocol';
|
||||||
|
|
||||||
import type {Point} from '../api/ElementHandle.js';
|
import type {Point} from '../api/ElementHandle.js';
|
||||||
import {
|
import {
|
||||||
@ -30,6 +31,7 @@ import {
|
|||||||
type MouseOptions,
|
type MouseOptions,
|
||||||
type MouseWheelOptions,
|
type MouseWheelOptions,
|
||||||
} from '../api/Input.js';
|
} from '../api/Input.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {KeyInput} from '../common/USKeyboardLayout.js';
|
import type {KeyInput} from '../common/USKeyboardLayout.js';
|
||||||
|
|
||||||
import type {BrowsingContext} from './BrowsingContext.js';
|
import type {BrowsingContext} from './BrowsingContext.js';
|
||||||
@ -627,6 +629,26 @@ export class BidiMouse extends Mouse {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override drag(): Promise<Protocol.Input.DragData> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override dragOver(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override dragEnter(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override drop(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override dragAndDrop(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ import type * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
|||||||
|
|
||||||
import type {ElementHandle} from '../api/ElementHandle.js';
|
import type {ElementHandle} from '../api/ElementHandle.js';
|
||||||
import {JSHandle} from '../api/JSHandle.js';
|
import {JSHandle} from '../api/JSHandle.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
|
|
||||||
import {BidiDeserializer} from './Deserializer.js';
|
import {BidiDeserializer} from './Deserializer.js';
|
||||||
import type {BidiRealm} from './Realm.js';
|
import type {BidiRealm} from './Realm.js';
|
||||||
@ -105,6 +106,6 @@ export class BidiJSHandle<T = unknown> extends JSHandle<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override remoteObject(): never {
|
override remoteObject(): never {
|
||||||
throw new Error('Not available in WebDriver BiDi');
|
throw new UnsupportedOperation('Not available in WebDriver BiDi');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,7 @@ import {
|
|||||||
} from '../../third_party/rxjs/rxjs.js';
|
} from '../../third_party/rxjs/rxjs.js';
|
||||||
import type {CDPSession} from '../api/CDPSession.js';
|
import type {CDPSession} from '../api/CDPSession.js';
|
||||||
import type {WaitForOptions} from '../api/Frame.js';
|
import type {WaitForOptions} from '../api/Frame.js';
|
||||||
|
import type {Metrics} from '../api/Page.js';
|
||||||
import {
|
import {
|
||||||
Page,
|
Page,
|
||||||
PageEvent,
|
PageEvent,
|
||||||
@ -38,17 +39,20 @@ import {
|
|||||||
type NewDocumentScriptEvaluation,
|
type NewDocumentScriptEvaluation,
|
||||||
type ScreenshotOptions,
|
type ScreenshotOptions,
|
||||||
} from '../api/Page.js';
|
} from '../api/Page.js';
|
||||||
|
import type {Target} from '../api/Target.js';
|
||||||
import {Accessibility} from '../cdp/Accessibility.js';
|
import {Accessibility} from '../cdp/Accessibility.js';
|
||||||
import {Coverage} from '../cdp/Coverage.js';
|
import {Coverage} from '../cdp/Coverage.js';
|
||||||
import {EmulationManager as CdpEmulationManager} from '../cdp/EmulationManager.js';
|
import {EmulationManager as CdpEmulationManager} from '../cdp/EmulationManager.js';
|
||||||
import {FrameTree} from '../cdp/FrameTree.js';
|
import {FrameTree} from '../cdp/FrameTree.js';
|
||||||
import {Tracing} from '../cdp/Tracing.js';
|
import {Tracing} from '../cdp/Tracing.js';
|
||||||
|
import type {WebWorker} from '../cdp/WebWorker.js';
|
||||||
import {
|
import {
|
||||||
ConsoleMessage,
|
ConsoleMessage,
|
||||||
type ConsoleMessageLocation,
|
type ConsoleMessageLocation,
|
||||||
} from '../common/ConsoleMessage.js';
|
} from '../common/ConsoleMessage.js';
|
||||||
import {TargetCloseError} from '../common/Errors.js';
|
import {TargetCloseError, UnsupportedOperation} from '../common/Errors.js';
|
||||||
import type {Handler} from '../common/EventEmitter.js';
|
import type {Handler} from '../common/EventEmitter.js';
|
||||||
|
import type {FileChooser} from '../common/FileChooser.js';
|
||||||
import {NetworkManagerEvent} from '../common/NetworkManagerEvents.js';
|
import {NetworkManagerEvent} from '../common/NetworkManagerEvents.js';
|
||||||
import type {PDFOptions} from '../common/PDFOptions.js';
|
import type {PDFOptions} from '../common/PDFOptions.js';
|
||||||
import type {Awaitable} from '../common/types.js';
|
import type {Awaitable} from '../common/types.js';
|
||||||
@ -61,6 +65,7 @@ import {
|
|||||||
waitForHTTP,
|
waitForHTTP,
|
||||||
} from '../common/util.js';
|
} from '../common/util.js';
|
||||||
import type {Viewport} from '../common/Viewport.js';
|
import type {Viewport} from '../common/Viewport.js';
|
||||||
|
import type {DeviceRequestPrompt, HTTPResponse} from '../puppeteer-core.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
import {disposeSymbol} from '../util/disposable.js';
|
import {disposeSymbol} from '../util/disposable.js';
|
||||||
@ -649,29 +654,34 @@ export class BidiPage extends Page {
|
|||||||
const {clip, type, captureBeyondViewport, allowViewportExpansion, quality} =
|
const {clip, type, captureBeyondViewport, allowViewportExpansion, quality} =
|
||||||
options;
|
options;
|
||||||
if (captureBeyondViewport && !allowViewportExpansion) {
|
if (captureBeyondViewport && !allowViewportExpansion) {
|
||||||
throw new Error(
|
throw new UnsupportedOperation(
|
||||||
`BiDi does not support 'captureBeyondViewport'. Use 'allowViewportExpansion'.`
|
`BiDi does not support 'captureBeyondViewport'. Use 'allowViewportExpansion'.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (options.omitBackground !== undefined && options.omitBackground) {
|
if (options.omitBackground !== undefined && options.omitBackground) {
|
||||||
throw new Error(`BiDi does not support 'omitBackground'.`);
|
throw new UnsupportedOperation(`BiDi does not support 'omitBackground'.`);
|
||||||
}
|
}
|
||||||
if (options.optimizeForSpeed !== undefined && options.optimizeForSpeed) {
|
if (options.optimizeForSpeed !== undefined && options.optimizeForSpeed) {
|
||||||
throw new Error(`BiDi does not support 'optimizeForSpeed'.`);
|
throw new UnsupportedOperation(
|
||||||
|
`BiDi does not support 'optimizeForSpeed'.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (options.fromSurface !== undefined && !options.fromSurface) {
|
if (options.fromSurface !== undefined && !options.fromSurface) {
|
||||||
throw new Error(`BiDi does not support 'fromSurface'.`);
|
throw new UnsupportedOperation(`BiDi does not support 'fromSurface'.`);
|
||||||
}
|
}
|
||||||
if (clip !== undefined && clip.scale !== undefined && clip.scale !== 1) {
|
if (clip !== undefined && clip.scale !== undefined && clip.scale !== 1) {
|
||||||
throw new Error(`BiDi does not support 'scale' in 'clip'.`);
|
throw new UnsupportedOperation(
|
||||||
|
`BiDi does not support 'scale' in 'clip'.`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const {
|
const {
|
||||||
result: {data},
|
result: {data},
|
||||||
} = await this.#connection.send('browsingContext.captureScreenshot', {
|
} = await this.#connection.send('browsingContext.captureScreenshot', {
|
||||||
context: this.mainFrame()._id,
|
context: this.mainFrame()._id,
|
||||||
format: {
|
format: {
|
||||||
type: `image/${type}`,
|
type: `image/${type}`,
|
||||||
...(quality === undefined ? {} : {quality: quality / 100}),
|
quality: quality ? quality / 100 : undefined,
|
||||||
},
|
},
|
||||||
clip: clip && {
|
clip: clip && {
|
||||||
type: 'box',
|
type: 'box',
|
||||||
@ -817,6 +827,83 @@ export class BidiPage extends Page {
|
|||||||
cacheDisabled: !enabled,
|
cacheDisabled: !enabled,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override isServiceWorkerBypassed(): boolean {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override target(): Target {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override waitForFileChooser(): Promise<FileChooser> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override workers(): WebWorker[] {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override setRequestInterception(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override setDragInterception(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override setBypassServiceWorker(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override setOfflineMode(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override emulateNetworkConditions(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override cookies(): Promise<Protocol.Network.Cookie[]> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override setCookie(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override deleteCookie(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override removeExposedFunction(): Promise<void> {
|
||||||
|
// TODO: Quick win?
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override authenticate(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override setExtraHTTPHeaders(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override metrics(): Promise<Metrics> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override goBack(): Promise<HTTPResponse | null> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override goForward(): Promise<HTTPResponse | null> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override waitForDevicePrompt(): Promise<DeviceRequestPrompt> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConsoleLogEntry(
|
function isConsoleLogEntry(
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
import type {CDPSession} from '../api/CDPSession.js';
|
import type {CDPSession} from '../api/CDPSession.js';
|
||||||
import {Target, TargetType} from '../api/Target.js';
|
import {Target, TargetType} from '../api/Target.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
|
|
||||||
import type {BidiBrowser} from './Browser.js';
|
import type {BidiBrowser} from './Browser.js';
|
||||||
import type {BidiBrowserContext} from './BrowserContext.js';
|
import type {BidiBrowserContext} from './BrowserContext.js';
|
||||||
@ -33,6 +34,10 @@ export class BidiTarget extends Target {
|
|||||||
this._browserContext = browserContext;
|
this._browserContext = browserContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setBrowserContext(browserContext: BidiBrowserContext): void {
|
||||||
|
this._browserContext = browserContext;
|
||||||
|
}
|
||||||
|
|
||||||
override async worker(): Promise<null> {
|
override async worker(): Promise<null> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -46,11 +51,19 @@ export class BidiTarget extends Target {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override opener(): Target | undefined {
|
override opener(): Target | undefined {
|
||||||
throw new Error('Not implemented');
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
|
|
||||||
_setBrowserContext(browserContext: BidiBrowserContext): void {
|
override url(): string {
|
||||||
this._browserContext = browserContext;
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override createCDPSession(): Promise<CDPSession> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
|
|
||||||
|
override type(): TargetType {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +130,7 @@ export class BiDiPageTarget extends BiDiBrowsingContextTarget {
|
|||||||
this.#page = new BidiPage(browsingContext, browserContext);
|
this.#page = new BidiPage(browsingContext, browserContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
override async page(): Promise<BidiPage | null> {
|
override async page(): Promise<BidiPage> {
|
||||||
return this.#page;
|
return this.#page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ import {catchError} from '../../third_party/rxjs/rxjs.js';
|
|||||||
import type {PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
import type {PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
||||||
import {ProtocolError, TimeoutError} from '../common/Errors.js';
|
import {ProtocolError, TimeoutError} from '../common/Errors.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export type BiDiNetworkIdle = Extract<
|
export type BiDiNetworkIdle = Extract<
|
||||||
PuppeteerLifeCycleEvent,
|
PuppeteerLifeCycleEvent,
|
||||||
'networkidle0' | 'networkidle2'
|
'networkidle0' | 'networkidle2'
|
||||||
@ -94,6 +97,9 @@ export const lifeCycleToSubscribedEvent = new Map<
|
|||||||
['domcontentloaded', 'browsingContext.domContentLoaded'],
|
['domcontentloaded', 'browsingContext.domContentLoaded'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function getBiDiLifecycleEvent(
|
export function getBiDiLifecycleEvent(
|
||||||
event: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]
|
event: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]
|
||||||
): [
|
): [
|
||||||
@ -105,6 +111,9 @@ export function getBiDiLifecycleEvent(
|
|||||||
return [bidiEvent, lifeCycles[1]];
|
return [bidiEvent, lifeCycles[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export function rewriteNavigationError<T, R extends ObservableInput<T>>(
|
export function rewriteNavigationError<T, R extends ObservableInput<T>>(
|
||||||
message: string,
|
message: string,
|
||||||
ms: number
|
ms: number
|
||||||
|
@ -143,7 +143,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
this.emit(BrowserEvent.Disconnected, undefined);
|
this.emit(BrowserEvent.Disconnected, undefined);
|
||||||
};
|
};
|
||||||
|
|
||||||
override async _attach(): Promise<void> {
|
async _attach(): Promise<void> {
|
||||||
this.#connection.on(CDPSessionEvent.Disconnected, this.#emitDisconnected);
|
this.#connection.on(CDPSessionEvent.Disconnected, this.#emitDisconnected);
|
||||||
this.#targetManager.on(
|
this.#targetManager.on(
|
||||||
TargetManagerEvent.TargetAvailable,
|
TargetManagerEvent.TargetAvailable,
|
||||||
@ -164,7 +164,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
await this.#targetManager.initialize();
|
await this.#targetManager.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
override _detach(): void {
|
_detach(): void {
|
||||||
this.#connection.off(CDPSessionEvent.Disconnected, this.#emitDisconnected);
|
this.#connection.off(CDPSessionEvent.Disconnected, this.#emitDisconnected);
|
||||||
this.#targetManager.off(
|
this.#targetManager.off(
|
||||||
TargetManagerEvent.TargetAvailable,
|
TargetManagerEvent.TargetAvailable,
|
||||||
@ -204,7 +204,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
override _getIsPageTargetCallback(): IsPageTargetCallback | undefined {
|
_getIsPageTargetCallback(): IsPageTargetCallback | undefined {
|
||||||
return this.#isPageTargetCallback;
|
return this.#isPageTargetCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +237,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
return this.#defaultContext;
|
return this.#defaultContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
override async _disposeContext(contextId?: string): Promise<void> {
|
async _disposeContext(contextId?: string): Promise<void> {
|
||||||
if (!contextId) {
|
if (!contextId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -349,7 +349,7 @@ export class CdpBrowser extends BrowserBase {
|
|||||||
return await this.#defaultContext.newPage();
|
return await this.#defaultContext.newPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
override async _createPageInContext(contextId?: string): Promise<Page> {
|
async _createPageInContext(contextId?: string): Promise<Page> {
|
||||||
const {targetId} = await this.#connection.send('Target.createTarget', {
|
const {targetId} = await this.#connection.send('Target.createTarget', {
|
||||||
url: 'about:blank',
|
url: 'about:blank',
|
||||||
browserContextId: contextId || undefined,
|
browserContextId: contextId || undefined,
|
||||||
|
@ -20,6 +20,7 @@ import type {CDPSession} from '../api/CDPSession.js';
|
|||||||
import {Frame, FrameEvent, throwIfDetached} from '../api/Frame.js';
|
import {Frame, FrameEvent, throwIfDetached} from '../api/Frame.js';
|
||||||
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
import type {WaitTimeoutOptions} from '../api/Page.js';
|
import type {WaitTimeoutOptions} from '../api/Page.js';
|
||||||
|
import {UnsupportedOperation} from '../common/Errors.js';
|
||||||
import {setPageContent} from '../common/util.js';
|
import {setPageContent} from '../common/util.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
import {disposeSymbol} from '../util/disposable.js';
|
import {disposeSymbol} from '../util/disposable.js';
|
||||||
@ -347,4 +348,8 @@ export class CdpFrame extends Frame {
|
|||||||
this.worlds[MAIN_WORLD][disposeSymbol]();
|
this.worlds[MAIN_WORLD][disposeSymbol]();
|
||||||
this.worlds[PUPPETEER_WORLD][disposeSymbol]();
|
this.worlds[PUPPETEER_WORLD][disposeSymbol]();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exposeFunction(): Promise<void> {
|
||||||
|
throw new UnsupportedOperation();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,14 @@ export class ProtocolError extends CustomError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puppeteer will throw this error if a method is not
|
||||||
|
* supported by the currently used protocol
|
||||||
|
*
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export class UnsupportedOperation extends CustomError {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user