mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: separate code to semantic folders (#10914)
This commit is contained in:
parent
b7bcc9a733
commit
09207a71b8
@ -127,7 +127,7 @@ sidebar_label: API
|
|||||||
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
|
| [SerializedAXNode](./puppeteer.serializedaxnode.md) | Represents a Node and the properties of it that are relevant to Accessibility. |
|
||||||
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
|
| [SnapshotOptions](./puppeteer.snapshotoptions.md) | |
|
||||||
| [TracingOptions](./puppeteer.tracingoptions.md) | |
|
| [TracingOptions](./puppeteer.tracingoptions.md) | |
|
||||||
| [Viewport](./puppeteer.viewport.md) | Sets the viewport of the page. |
|
| [Viewport](./puppeteer.viewport.md) | |
|
||||||
| [WaitForOptions](./puppeteer.waitforoptions.md) | |
|
| [WaitForOptions](./puppeteer.waitforoptions.md) | |
|
||||||
| [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | |
|
| [WaitForSelectorOptions](./puppeteer.waitforselectoroptions.md) | |
|
||||||
| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
|
| [WaitForTargetOptions](./puppeteer.waitfortargetoptions.md) | |
|
||||||
|
@ -4,8 +4,6 @@ sidebar_label: Viewport
|
|||||||
|
|
||||||
# Viewport interface
|
# Viewport interface
|
||||||
|
|
||||||
Sets the viewport of the page.
|
|
||||||
|
|
||||||
#### Signature:
|
#### Signature:
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';
|
import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';
|
||||||
|
|
||||||
import type {Connection} from '../common/Connection.js';
|
import type {Connection} from '../cdp/Connection.js';
|
||||||
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,6 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type Frame} from '../api/Frame.js';
|
import {type Frame} from '../api/Frame.js';
|
||||||
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
|
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
|
||||||
import {type WaitForSelectorOptions} from '../common/IsolatedWorld.js';
|
|
||||||
import {LazyArg} from '../common/LazyArg.js';
|
import {LazyArg} from '../common/LazyArg.js';
|
||||||
import {
|
import {
|
||||||
type ElementFor,
|
type ElementFor,
|
||||||
@ -39,7 +38,7 @@ import {
|
|||||||
type MouseClickOptions,
|
type MouseClickOptions,
|
||||||
} from './Input.js';
|
} from './Input.js';
|
||||||
import {JSHandle} from './JSHandle.js';
|
import {JSHandle} from './JSHandle.js';
|
||||||
import {type ScreenshotOptions} from './Page.js';
|
import {type ScreenshotOptions, type WaitForSelectorOptions} from './Page.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
@ -18,17 +18,18 @@ import type Protocol from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type ClickOptions, type ElementHandle} from '../api/ElementHandle.js';
|
import {type ClickOptions, type ElementHandle} from '../api/ElementHandle.js';
|
||||||
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
import {type Page, type WaitTimeoutOptions} from '../api/Page.js';
|
import {
|
||||||
import {type DeviceRequestPrompt} from '../common/DeviceRequestPrompt.js';
|
type Page,
|
||||||
|
type WaitForSelectorOptions,
|
||||||
|
type WaitTimeoutOptions,
|
||||||
|
} from '../api/Page.js';
|
||||||
|
import {type DeviceRequestPrompt} from '../cdp/DeviceRequestPrompt.js';
|
||||||
|
import {type IsolatedWorldChart} from '../cdp/IsolatedWorld.js';
|
||||||
|
import {type PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
||||||
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
|
import {getQueryHandlerAndSelector} from '../common/GetQueryHandler.js';
|
||||||
import {transposeIterableHandle} from '../common/HandleIterator.js';
|
import {transposeIterableHandle} from '../common/HandleIterator.js';
|
||||||
import {
|
|
||||||
type IsolatedWorldChart,
|
|
||||||
type WaitForSelectorOptions,
|
|
||||||
} from '../common/IsolatedWorld.js';
|
|
||||||
import {LazyArg} from '../common/LazyArg.js';
|
import {LazyArg} from '../common/LazyArg.js';
|
||||||
import {type PuppeteerLifeCycleEvent} from '../common/LifecycleWatcher.js';
|
|
||||||
import {
|
import {
|
||||||
type Awaitable,
|
type Awaitable,
|
||||||
type EvaluateFunc,
|
type EvaluateFunc,
|
||||||
|
@ -36,12 +36,21 @@ import {
|
|||||||
} from '../../third_party/rxjs/rxjs.js';
|
} from '../../third_party/rxjs/rxjs.js';
|
||||||
import type {HTTPRequest} from '../api/HTTPRequest.js';
|
import type {HTTPRequest} from '../api/HTTPRequest.js';
|
||||||
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
import type {Accessibility} from '../common/Accessibility.js';
|
import type {BidiNetworkManager} from '../bidi/NetworkManager.js';
|
||||||
import type {BidiNetworkManager} from '../common/bidi/NetworkManager.js';
|
import type {Accessibility} from '../cdp/Accessibility.js';
|
||||||
|
import type {Coverage} from '../cdp/Coverage.js';
|
||||||
|
import {type DeviceRequestPrompt} from '../cdp/DeviceRequestPrompt.js';
|
||||||
|
import type {PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
||||||
|
import {
|
||||||
|
type NetworkManager as CdpNetworkManager,
|
||||||
|
type Credentials,
|
||||||
|
type NetworkConditions,
|
||||||
|
NetworkManagerEvent,
|
||||||
|
} from '../cdp/NetworkManager.js';
|
||||||
|
import type {Tracing} from '../cdp/Tracing.js';
|
||||||
|
import type {WebWorker} from '../cdp/WebWorker.js';
|
||||||
import type {ConsoleMessage} from '../common/ConsoleMessage.js';
|
import type {ConsoleMessage} from '../common/ConsoleMessage.js';
|
||||||
import type {Coverage} from '../common/Coverage.js';
|
|
||||||
import {type Device} from '../common/Device.js';
|
import {type Device} from '../common/Device.js';
|
||||||
import {type DeviceRequestPrompt} from '../common/DeviceRequestPrompt.js';
|
|
||||||
import {TargetCloseError} from '../common/Errors.js';
|
import {TargetCloseError} from '../common/Errors.js';
|
||||||
import {
|
import {
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
@ -50,22 +59,12 @@ import {
|
|||||||
type Handler,
|
type Handler,
|
||||||
} from '../common/EventEmitter.js';
|
} from '../common/EventEmitter.js';
|
||||||
import type {FileChooser} from '../common/FileChooser.js';
|
import type {FileChooser} from '../common/FileChooser.js';
|
||||||
import type {WaitForSelectorOptions} from '../common/IsolatedWorld.js';
|
|
||||||
import type {PuppeteerLifeCycleEvent} from '../common/LifecycleWatcher.js';
|
|
||||||
import {
|
|
||||||
type NetworkManager as CdpNetworkManager,
|
|
||||||
type Credentials,
|
|
||||||
type NetworkConditions,
|
|
||||||
NetworkManagerEvent,
|
|
||||||
} from '../common/NetworkManager.js';
|
|
||||||
import {
|
import {
|
||||||
type LowerCasePaperFormat,
|
type LowerCasePaperFormat,
|
||||||
paperFormats,
|
paperFormats,
|
||||||
type ParsedPDFOptions,
|
type ParsedPDFOptions,
|
||||||
type PDFOptions,
|
type PDFOptions,
|
||||||
} from '../common/PDFOptions.js';
|
} from '../common/PDFOptions.js';
|
||||||
import type {Viewport} from '../common/PuppeteerViewport.js';
|
|
||||||
import type {Tracing} from '../common/Tracing.js';
|
|
||||||
import type {
|
import type {
|
||||||
Awaitable,
|
Awaitable,
|
||||||
EvaluateFunc,
|
EvaluateFunc,
|
||||||
@ -81,7 +80,7 @@ import {
|
|||||||
timeout,
|
timeout,
|
||||||
withSourcePuppeteerURLIfNone,
|
withSourcePuppeteerURLIfNone,
|
||||||
} from '../common/util.js';
|
} from '../common/util.js';
|
||||||
import type {WebWorker} from '../common/WebWorker.js';
|
import type {Viewport} from '../common/Viewport.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {type Deferred} from '../util/Deferred.js';
|
import {type Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
@ -162,6 +161,38 @@ export interface WaitForOptions {
|
|||||||
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export interface WaitForSelectorOptions {
|
||||||
|
/**
|
||||||
|
* Wait for the selected element to be present in DOM and to be visible, i.e.
|
||||||
|
* to not have `display: none` or `visibility: hidden` CSS properties.
|
||||||
|
*
|
||||||
|
* @defaultValue `false`
|
||||||
|
*/
|
||||||
|
visible?: boolean;
|
||||||
|
/**
|
||||||
|
* Wait for the selected element to not be found in the DOM or to be hidden,
|
||||||
|
* i.e. have `display: none` or `visibility: hidden` CSS properties.
|
||||||
|
*
|
||||||
|
* @defaultValue `false`
|
||||||
|
*/
|
||||||
|
hidden?: boolean;
|
||||||
|
/**
|
||||||
|
* Maximum time to wait in milliseconds. Pass `0` to disable timeout.
|
||||||
|
*
|
||||||
|
* The default value can be changed by using {@link Page.setDefaultTimeout}
|
||||||
|
*
|
||||||
|
* @defaultValue `30_000` (30 seconds)
|
||||||
|
*/
|
||||||
|
timeout?: number;
|
||||||
|
/**
|
||||||
|
* A signal object that allows you to cancel a waitForSelector call.
|
||||||
|
*/
|
||||||
|
signal?: AbortSignal;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import type {Browser} from '../api/Browser.js';
|
import type {Browser} from '../api/Browser.js';
|
||||||
import type {BrowserContext} from '../api/BrowserContext.js';
|
import type {BrowserContext} from '../api/BrowserContext.js';
|
||||||
import {type Page} from '../api/Page.js';
|
import {type Page} from '../api/Page.js';
|
||||||
import {type WebWorker} from '../common/WebWorker.js';
|
import {type WebWorker} from '../cdp/WebWorker.js';
|
||||||
|
|
||||||
import {type CDPSession} from './CDPSession.js';
|
import {type CDPSession} from './CDPSession.js';
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {type Observable} from '../../../third_party/rxjs/rxjs.js';
|
import {type Observable} from '../../../third_party/rxjs/rxjs.js';
|
||||||
import {type HandleFor} from '../../common/common.js';
|
import {type HandleFor} from '../../common/types.js';
|
||||||
|
|
||||||
import {Locator, type VisibilityOption} from './locators.js';
|
import {Locator, type VisibilityOption} from './locators.js';
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import {
|
|||||||
mergeMap,
|
mergeMap,
|
||||||
throwIfEmpty,
|
throwIfEmpty,
|
||||||
} from '../../../third_party/rxjs/rxjs.js';
|
} from '../../../third_party/rxjs/rxjs.js';
|
||||||
import {type Awaitable, type HandleFor} from '../../common/common.js';
|
import {type Awaitable, type HandleFor} from '../../common/types.js';
|
||||||
|
|
||||||
import {DelegatedLocator} from './DelegatedLocator.js';
|
import {DelegatedLocator} from './DelegatedLocator.js';
|
||||||
import {type ActionOptions, type Locator} from './locators.js';
|
import {type ActionOptions, type Locator} from './locators.js';
|
||||||
|
@ -19,7 +19,7 @@ import {
|
|||||||
from,
|
from,
|
||||||
mergeMap,
|
mergeMap,
|
||||||
} from '../../../third_party/rxjs/rxjs.js';
|
} from '../../../third_party/rxjs/rxjs.js';
|
||||||
import {type Awaitable, type HandleFor} from '../../common/common.js';
|
import {type Awaitable, type HandleFor} from '../../common/types.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type ActionOptions,
|
type ActionOptions,
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {type Observable, race} from '../../../third_party/rxjs/rxjs.js';
|
import {type Observable, race} from '../../../third_party/rxjs/rxjs.js';
|
||||||
import {type HandleFor} from '../../puppeteer-core.js';
|
import {type HandleFor} from '../../common/types.js';
|
||||||
|
|
||||||
import {type ActionOptions, Locator} from './locators.js';
|
import {type ActionOptions, Locator} from './locators.js';
|
||||||
|
|
||||||
|
@ -18,10 +18,10 @@ import * as BidiMapper from 'chromium-bidi/lib/cjs/bidiMapper/bidiMapper.js';
|
|||||||
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 {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';
|
import type {ProtocolMapping} from 'devtools-protocol/types/protocol-mapping.js';
|
||||||
|
|
||||||
import {type CDPEvents, type CDPSession} from '../../api/CDPSession.js';
|
import {type CDPEvents, type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type Connection as CdpConnection} from '../Connection.js';
|
import {type Connection as CdpConnection} from '../cdp/Connection.js';
|
||||||
import {TargetCloseError} from '../Errors.js';
|
import {TargetCloseError} from '../common/Errors.js';
|
||||||
import {type Handler} from '../EventEmitter.js';
|
import {type Handler} from '../common/EventEmitter.js';
|
||||||
|
|
||||||
import {BidiConnection} from './Connection.js';
|
import {BidiConnection} from './Connection.js';
|
||||||
|
|
@ -23,12 +23,12 @@ import {
|
|||||||
type BrowserCloseCallback,
|
type BrowserCloseCallback,
|
||||||
type BrowserContextOptions,
|
type BrowserContextOptions,
|
||||||
BrowserEvent,
|
BrowserEvent,
|
||||||
} from '../../api/Browser.js';
|
} from '../api/Browser.js';
|
||||||
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 {type Handler} from '../EventEmitter.js';
|
import {type Handler} from '../common/EventEmitter.js';
|
||||||
import {type Viewport} from '../PuppeteerViewport.js';
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
|
|
||||||
import {BidiBrowserContext} from './BrowserContext.js';
|
import {BidiBrowserContext} from './BrowserContext.js';
|
||||||
import {BrowsingContext, BrowsingContextEvent} from './BrowsingContext.js';
|
import {BrowsingContext, BrowsingContextEvent} from './BrowsingContext.js';
|
||||||
@ -39,7 +39,7 @@ import {
|
|||||||
BiDiPageTarget,
|
BiDiPageTarget,
|
||||||
type BidiTarget,
|
type BidiTarget,
|
||||||
} from './Target.js';
|
} from './Target.js';
|
||||||
import {debugError} from './utils.js';
|
import {debugError} from './util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.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 {type Viewport} from '../PuppeteerViewport.js';
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
|
|
||||||
import {type BidiBrowser} from './Browser.js';
|
import {type BidiBrowser} from './Browser.js';
|
||||||
import {type BidiConnection} from './Connection.js';
|
import {type BidiConnection} from './Connection.js';
|
@ -1,19 +1,23 @@
|
|||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
import type ProtocolMapping from 'devtools-protocol/types/protocol-mapping.js';
|
||||||
|
|
||||||
import {CDPSession} from '../../api/CDPSession.js';
|
import {CDPSession} from '../api/CDPSession.js';
|
||||||
import {type WaitForOptions} from '../../api/Page.js';
|
import {type WaitForOptions} from '../api/Page.js';
|
||||||
import {assert} from '../../util/assert.js';
|
import {type Connection as CdpConnection} from '../cdp/Connection.js';
|
||||||
import {Deferred} from '../../util/Deferred.js';
|
import {type PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
||||||
import {type Connection as CdpConnection} from '../Connection.js';
|
import {
|
||||||
import {ProtocolError, TargetCloseError, TimeoutError} from '../Errors.js';
|
ProtocolError,
|
||||||
import {type EventType} from '../EventEmitter.js';
|
TargetCloseError,
|
||||||
import {type PuppeteerLifeCycleEvent} from '../LifecycleWatcher.js';
|
TimeoutError,
|
||||||
import {setPageContent, waitWithTimeout} from '../util.js';
|
} from '../common/Errors.js';
|
||||||
|
import {type EventType} from '../common/EventEmitter.js';
|
||||||
|
import {setPageContent, waitWithTimeout} from '../common/util.js';
|
||||||
|
import {assert} from '../util/assert.js';
|
||||||
|
import {Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
import {type BidiConnection} from './Connection.js';
|
import {type BidiConnection} from './Connection.js';
|
||||||
import {Realm} from './Realm.js';
|
import {Realm} from './Realm.js';
|
||||||
import {debugError} from './utils.js';
|
import {debugError} from './util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -18,7 +18,7 @@ import {describe, it} from 'node:test';
|
|||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
import {type ConnectionTransport} from '../ConnectionTransport.js';
|
import {type ConnectionTransport} from '../common/ConnectionTransport.js';
|
||||||
|
|
||||||
import {BidiConnection} from './Connection.js';
|
import {BidiConnection} from './Connection.js';
|
||||||
|
|
@ -16,13 +16,13 @@
|
|||||||
|
|
||||||
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 {CallbackRegistry} from '../Connection.js';
|
import {CallbackRegistry} from '../cdp/Connection.js';
|
||||||
import {type ConnectionTransport} from '../ConnectionTransport.js';
|
import {type ConnectionTransport} from '../common/ConnectionTransport.js';
|
||||||
import {debug} from '../Debug.js';
|
import {debug} from '../common/Debug.js';
|
||||||
import {EventEmitter} from '../EventEmitter.js';
|
import {EventEmitter} from '../common/EventEmitter.js';
|
||||||
|
|
||||||
import {type BrowsingContext, cdpSessions} from './BrowsingContext.js';
|
import {type BrowsingContext, cdpSessions} from './BrowsingContext.js';
|
||||||
import {debugError} from './utils.js';
|
import {debugError} from './util.js';
|
||||||
|
|
||||||
const debugProtocolSend = debug('puppeteer:webDriverBiDi:SEND ►');
|
const debugProtocolSend = debug('puppeteer:webDriverBiDi:SEND ►');
|
||||||
const debugProtocolReceive = debug('puppeteer:webDriverBiDi:RECV ◀');
|
const debugProtocolReceive = debug('puppeteer:webDriverBiDi:RECV ◀');
|
@ -16,7 +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 {Dialog} from '../../api/Dialog.js';
|
import {Dialog} from '../api/Dialog.js';
|
||||||
|
|
||||||
import {type BrowsingContext} from './BrowsingContext.js';
|
import {type BrowsingContext} from './BrowsingContext.js';
|
||||||
|
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
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 {throwIfDisposed} from '../../util/decorators.js';
|
import {throwIfDisposed} from '../util/decorators.js';
|
||||||
|
|
||||||
import {type BidiFrame} from './Frame.js';
|
import {type BidiFrame} from './Frame.js';
|
||||||
import {BidiJSHandle} from './JSHandle.js';
|
import {BidiJSHandle} from './JSHandle.js';
|
@ -16,15 +16,15 @@
|
|||||||
|
|
||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
|
|
||||||
import {assert} from '../../util/assert.js';
|
import {type Awaitable, type FlattenHandle} from '../common/types.js';
|
||||||
import {Deferred} from '../../util/Deferred.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {interpolateFunction, stringifyFunction} from '../../util/Function.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
import {type Awaitable, type FlattenHandle} from '../types.js';
|
import {interpolateFunction, stringifyFunction} from '../util/Function.js';
|
||||||
|
|
||||||
import {type BidiConnection} from './Connection.js';
|
import {type BidiConnection} from './Connection.js';
|
||||||
import {type BidiFrame} from './Frame.js';
|
import {type BidiFrame} from './Frame.js';
|
||||||
import {BidiSerializer} from './Serializer.js';
|
import {BidiSerializer} from './Serializer.js';
|
||||||
import {debugError} from './utils.js';
|
import {debugError} from './util.js';
|
||||||
|
|
||||||
type SendArgsChannel<Args> = (value: [id: number, args: Args]) => void;
|
type SendArgsChannel<Args> = (value: [id: number, args: Args]) => void;
|
||||||
type SendResolveChannel<Ret> = (
|
type SendResolveChannel<Ret> = (
|
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
|
|
||||||
import {type CDPSession} from '../../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {Frame, throwIfDetached} from '../../api/Frame.js';
|
import {Frame, throwIfDetached} from '../api/Frame.js';
|
||||||
import {Deferred} from '../../util/Deferred.js';
|
import {UTILITY_WORLD_NAME} from '../cdp/FrameManager.js';
|
||||||
import {UTILITY_WORLD_NAME} from '../FrameManager.js';
|
import {type PuppeteerLifeCycleEvent} from '../cdp/LifecycleWatcher.js';
|
||||||
import {type PuppeteerLifeCycleEvent} from '../LifecycleWatcher.js';
|
import {type TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
import {type TimeoutSettings} from '../TimeoutSettings.js';
|
import {type Awaitable} from '../common/types.js';
|
||||||
import {type Awaitable} from '../types.js';
|
import {waitForEvent} from '../common/util.js';
|
||||||
import {waitForEvent} from '../util.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type BrowsingContext,
|
type BrowsingContext,
|
@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
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 Frame} from '../../api/Frame.js';
|
import {type Frame} from '../api/Frame.js';
|
||||||
import {HTTPRequest, type ResourceType} from '../../api/HTTPRequest.js';
|
import {HTTPRequest, type ResourceType} from '../api/HTTPRequest.js';
|
||||||
|
|
||||||
import {type BidiHTTPResponse} from './HTTPResponse.js';
|
import {type BidiHTTPResponse} from './HTTPResponse.js';
|
||||||
|
|
@ -16,11 +16,11 @@
|
|||||||
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 Frame} from '../../api/Frame.js';
|
import {type Frame} from '../api/Frame.js';
|
||||||
import {
|
import {
|
||||||
HTTPResponse as HTTPResponse,
|
HTTPResponse as HTTPResponse,
|
||||||
type RemoteAddress,
|
type RemoteAddress,
|
||||||
} from '../../api/HTTPResponse.js';
|
} from '../api/HTTPResponse.js';
|
||||||
|
|
||||||
import {type BidiHTTPRequest} from './HTTPRequest.js';
|
import {type BidiHTTPRequest} from './HTTPRequest.js';
|
||||||
|
|
@ -16,7 +16,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 Point} from '../../api/ElementHandle.js';
|
import {type Point} from '../api/ElementHandle.js';
|
||||||
import {
|
import {
|
||||||
Keyboard as BaseKeyboard,
|
Keyboard as BaseKeyboard,
|
||||||
Mouse as BaseMouse,
|
Mouse as BaseMouse,
|
||||||
@ -29,8 +29,8 @@ import {
|
|||||||
type MouseMoveOptions,
|
type MouseMoveOptions,
|
||||||
type MouseOptions,
|
type MouseOptions,
|
||||||
type MouseWheelOptions,
|
type MouseWheelOptions,
|
||||||
} from '../../api/Input.js';
|
} from '../api/Input.js';
|
||||||
import {type KeyInput} from '../USKeyboardLayout.js';
|
import {type KeyInput} from '../common/USKeyboardLayout.js';
|
||||||
|
|
||||||
import {type BrowsingContext} from './BrowsingContext.js';
|
import {type BrowsingContext} from './BrowsingContext.js';
|
||||||
|
|
@ -17,13 +17,13 @@
|
|||||||
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 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 {type Realm} from './Realm.js';
|
import {type Realm} from './Realm.js';
|
||||||
import {type Sandbox} from './Sandbox.js';
|
import {type Sandbox} from './Sandbox.js';
|
||||||
import {BidiSerializer} from './Serializer.js';
|
import {BidiSerializer} from './Serializer.js';
|
||||||
import {releaseReference} from './utils.js';
|
import {releaseReference} from './util.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
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 {NetworkManagerEvent} from '../cdp/NetworkManager.js';
|
||||||
import {
|
import {
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
EventSubscription,
|
EventSubscription,
|
||||||
type EventType,
|
type EventType,
|
||||||
} from '../EventEmitter.js';
|
} from '../common/EventEmitter.js';
|
||||||
import {NetworkManagerEvent} from '../NetworkManager.js';
|
|
||||||
|
|
||||||
import {type BidiConnection} from './Connection.js';
|
import {type BidiConnection} from './Connection.js';
|
||||||
import {type BidiFrame} from './Frame.js';
|
import {type BidiFrame} from './Frame.js';
|
@ -19,7 +19,7 @@ import type {Readable} from 'stream';
|
|||||||
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 CDPSession} from '../api/CDPSession.js';
|
||||||
import {
|
import {
|
||||||
type GeolocationOptions,
|
type GeolocationOptions,
|
||||||
type MediaFeature,
|
type MediaFeature,
|
||||||
@ -28,25 +28,22 @@ import {
|
|||||||
PageEvent,
|
PageEvent,
|
||||||
type ScreenshotOptions,
|
type ScreenshotOptions,
|
||||||
type WaitForOptions,
|
type WaitForOptions,
|
||||||
} from '../../api/Page.js';
|
} from '../api/Page.js';
|
||||||
import {assert} from '../../util/assert.js';
|
import {Accessibility} from '../cdp/Accessibility.js';
|
||||||
import {Deferred} from '../../util/Deferred.js';
|
import {Coverage} from '../cdp/Coverage.js';
|
||||||
import {Accessibility} from '../Accessibility.js';
|
import {EmulationManager as CdpEmulationManager} from '../cdp/EmulationManager.js';
|
||||||
|
import {FrameTree} from '../cdp/FrameTree.js';
|
||||||
|
import {NetworkManagerEvent} from '../cdp/NetworkManager.js';
|
||||||
|
import {Tracing} from '../cdp/Tracing.js';
|
||||||
import {
|
import {
|
||||||
ConsoleMessage,
|
ConsoleMessage,
|
||||||
type ConsoleMessageLocation,
|
type ConsoleMessageLocation,
|
||||||
} from '../ConsoleMessage.js';
|
} from '../common/ConsoleMessage.js';
|
||||||
import {Coverage} from '../Coverage.js';
|
import {TargetCloseError} from '../common/Errors.js';
|
||||||
import {EmulationManager as CdpEmulationManager} from '../EmulationManager.js';
|
import {type Handler} from '../common/EventEmitter.js';
|
||||||
import {TargetCloseError} from '../Errors.js';
|
import {type PDFOptions} from '../common/PDFOptions.js';
|
||||||
import {type Handler} from '../EventEmitter.js';
|
import {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
import {FrameTree} from '../FrameTree.js';
|
import {type Awaitable} from '../common/types.js';
|
||||||
import {NetworkManagerEvent} from '../NetworkManager.js';
|
|
||||||
import {type PDFOptions} from '../PDFOptions.js';
|
|
||||||
import {type Viewport} from '../PuppeteerViewport.js';
|
|
||||||
import {TimeoutSettings} from '../TimeoutSettings.js';
|
|
||||||
import {Tracing} from '../Tracing.js';
|
|
||||||
import {type Awaitable} from '../types.js';
|
|
||||||
import {
|
import {
|
||||||
debugError,
|
debugError,
|
||||||
evaluationString,
|
evaluationString,
|
||||||
@ -54,7 +51,10 @@ import {
|
|||||||
validateDialogType,
|
validateDialogType,
|
||||||
waitForEvent,
|
waitForEvent,
|
||||||
waitWithTimeout,
|
waitWithTimeout,
|
||||||
} from '../util.js';
|
} from '../common/util.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
|
import {assert} from '../util/assert.js';
|
||||||
|
import {Deferred} from '../util/Deferred.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';
|
@ -1,22 +1,22 @@
|
|||||||
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
import * as Bidi from 'chromium-bidi/lib/cjs/protocol/protocol.js';
|
||||||
|
|
||||||
import type PuppeteerUtil from '../../injected/injected.js';
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
import {stringifyFunction} from '../../util/Function.js';
|
import {scriptInjector} from '../common/ScriptInjector.js';
|
||||||
import {EventEmitter, type EventType} from '../EventEmitter.js';
|
import {type EvaluateFunc, type HandleFor} from '../common/types.js';
|
||||||
import {scriptInjector} from '../ScriptInjector.js';
|
|
||||||
import {type EvaluateFunc, type HandleFor} from '../types.js';
|
|
||||||
import {
|
import {
|
||||||
PuppeteerURL,
|
PuppeteerURL,
|
||||||
getSourcePuppeteerURLIfAvailable,
|
getSourcePuppeteerURLIfAvailable,
|
||||||
isString,
|
isString,
|
||||||
} from '../util.js';
|
} from '../common/util.js';
|
||||||
|
import type PuppeteerUtil from '../injected/injected.js';
|
||||||
|
import {stringifyFunction} from '../util/Function.js';
|
||||||
|
|
||||||
import {type BidiConnection} from './Connection.js';
|
import {type BidiConnection} from './Connection.js';
|
||||||
import {BidiElementHandle} from './ElementHandle.js';
|
import {BidiElementHandle} from './ElementHandle.js';
|
||||||
import {BidiJSHandle} from './JSHandle.js';
|
import {BidiJSHandle} from './JSHandle.js';
|
||||||
import {type Sandbox} from './Sandbox.js';
|
import {type Sandbox} from './Sandbox.js';
|
||||||
import {BidiSerializer} from './Serializer.js';
|
import {BidiSerializer} from './Serializer.js';
|
||||||
import {createEvaluationError} from './utils.js';
|
import {createEvaluationError} from './util.js';
|
||||||
|
|
||||||
export const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
|
export const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
|
||||||
|
|
@ -14,11 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {type JSHandle} from '../../api/JSHandle.js';
|
import {type JSHandle} from '../api/JSHandle.js';
|
||||||
import {Realm} from '../../api/Realm.js';
|
import {Realm} from '../api/Realm.js';
|
||||||
import {type TimeoutSettings} from '../TimeoutSettings.js';
|
import {type TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
import {type EvaluateFunc, type HandleFor} from '../types.js';
|
import {type EvaluateFunc, type HandleFor} from '../common/types.js';
|
||||||
import {withSourcePuppeteerURLIfNone} from '../util.js';
|
import {withSourcePuppeteerURLIfNone} from '../common/util.js';
|
||||||
|
|
||||||
import {type BrowsingContext} from './BrowsingContext.js';
|
import {type BrowsingContext} from './BrowsingContext.js';
|
||||||
import {type BidiFrame} from './Frame.js';
|
import {type BidiFrame} from './Frame.js';
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
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 {LazyArg} from '../LazyArg.js';
|
import {LazyArg} from '../common/LazyArg.js';
|
||||||
import {debugError, isDate, isPlainObject, isRegExp} from '../util.js';
|
import {debugError, isDate, isPlainObject, isRegExp} from '../common/util.js';
|
||||||
|
|
||||||
import {BidiElementHandle} from './ElementHandle.js';
|
import {BidiElementHandle} from './ElementHandle.js';
|
||||||
import {BidiJSHandle} from './JSHandle.js';
|
import {BidiJSHandle} from './JSHandle.js';
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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 type {WebWorker} from '../WebWorker.js';
|
import type {WebWorker} from '../cdp/WebWorker.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';
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
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 {debug} from '../Debug.js';
|
import {debug} from '../common/Debug.js';
|
||||||
import {PuppeteerURL} from '../util.js';
|
import {PuppeteerURL} from '../common/util.js';
|
||||||
|
|
||||||
import {type Realm} from './Realm.js';
|
import {type Realm} from './Realm.js';
|
||||||
import {BidiSerializer} from './Serializer.js';
|
import {BidiSerializer} from './Serializer.js';
|
||||||
@ -26,6 +26,7 @@ import {BidiSerializer} from './Serializer.js';
|
|||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
export const debugError = debug('puppeteer:error');
|
export const debugError = debug('puppeteer:error');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
@ -18,12 +18,12 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type ElementHandle} from '../api/ElementHandle.js';
|
import {type ElementHandle} from '../api/ElementHandle.js';
|
||||||
|
import {QueryHandler, type QuerySelector} from '../common/QueryHandler.js';
|
||||||
|
import {type AwaitableIterable} from '../common/types.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
|
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
|
||||||
|
|
||||||
import {type IsolatedWorld} from './IsolatedWorld.js';
|
import {type IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {QueryHandler, type QuerySelector} from './QueryHandler.js';
|
|
||||||
import {type AwaitableIterable} from './types.js';
|
|
||||||
|
|
||||||
const queryAXTree = async (
|
const queryAXTree = async (
|
||||||
client: CDPSession,
|
client: CDPSession,
|
@ -1,8 +1,8 @@
|
|||||||
import {JSHandle} from '../api/JSHandle.js';
|
import {JSHandle} from '../api/JSHandle.js';
|
||||||
|
import {debugError} from '../common/util.js';
|
||||||
import {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
|
|
||||||
import {type ExecutionContext} from './ExecutionContext.js';
|
import {type ExecutionContext} from './ExecutionContext.js';
|
||||||
import {debugError} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -32,13 +32,14 @@ import {BrowserContext, BrowserContextEvent} from '../api/BrowserContext.js';
|
|||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.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 {TaskQueue} from '../common/TaskQueue.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
import {USE_TAB_TARGET} from '../environment.js';
|
import {USE_TAB_TARGET} from '../environment.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
|
|
||||||
import {ChromeTargetManager} from './ChromeTargetManager.js';
|
import {ChromeTargetManager} from './ChromeTargetManager.js';
|
||||||
import {type Connection} from './Connection.js';
|
import {type Connection} from './Connection.js';
|
||||||
import {FirefoxTargetManager} from './FirefoxTargetManager.js';
|
import {FirefoxTargetManager} from './FirefoxTargetManager.js';
|
||||||
import {type Viewport} from './PuppeteerViewport.js';
|
|
||||||
import {
|
import {
|
||||||
type CdpTarget,
|
type CdpTarget,
|
||||||
DevToolsTarget,
|
DevToolsTarget,
|
||||||
@ -48,7 +49,6 @@ import {
|
|||||||
WorkerTarget,
|
WorkerTarget,
|
||||||
} from './Target.js';
|
} from './Target.js';
|
||||||
import {type TargetManager, TargetManagerEvent} from './TargetManager.js';
|
import {type TargetManager, TargetManagerEvent} from './TargetManager.js';
|
||||||
import {TaskQueue} from './TaskQueue.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -18,17 +18,17 @@ import {
|
|||||||
type IsPageTargetCallback,
|
type IsPageTargetCallback,
|
||||||
type TargetFilterCallback,
|
type TargetFilterCallback,
|
||||||
} from '../api/Browser.js';
|
} from '../api/Browser.js';
|
||||||
|
import {type ConnectionTransport} from '../common/ConnectionTransport.js';
|
||||||
|
import {getFetch} from '../common/fetch.js';
|
||||||
|
import {debugError} from '../common/util.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
import {isNode} from '../environment.js';
|
import {isNode} from '../environment.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
|
|
||||||
import {CdpBrowser} from './Browser.js';
|
import {CdpBrowser} from './Browser.js';
|
||||||
import {Connection} from './Connection.js';
|
import {Connection} from './Connection.js';
|
||||||
import {type ConnectionTransport} from './ConnectionTransport.js';
|
|
||||||
import {getFetch} from './fetch.js';
|
|
||||||
import type {ConnectOptions} from './Puppeteer.js';
|
import type {ConnectOptions} from './Puppeteer.js';
|
||||||
import {type Viewport} from './PuppeteerViewport.js';
|
|
||||||
import {debugError} from './util.js';
|
|
||||||
/**
|
/**
|
||||||
* Generic browser options that can be passed when launching any browser or when
|
* Generic browser options that can be passed when launching any browser or when
|
||||||
* connecting to an existing browser instance.
|
* connecting to an existing browser instance.
|
||||||
@ -72,8 +72,8 @@ export interface BrowserConnectOptions {
|
|||||||
|
|
||||||
const getWebSocketTransportClass = async () => {
|
const getWebSocketTransportClass = async () => {
|
||||||
return isNode
|
return isNode
|
||||||
? (await import('./NodeWebSocketTransport.js')).NodeWebSocketTransport
|
? (await import('../node/NodeWebSocketTransport.js')).NodeWebSocketTransport
|
||||||
: (await import('./BrowserWebSocketTransport.js'))
|
: (await import('../common/BrowserWebSocketTransport.js'))
|
||||||
.BrowserWebSocketTransport;
|
.BrowserWebSocketTransport;
|
||||||
};
|
};
|
||||||
|
|
@ -5,6 +5,7 @@ import {
|
|||||||
CDPSession,
|
CDPSession,
|
||||||
CDPSessionEvent,
|
CDPSessionEvent,
|
||||||
} from '../api/CDPSession.js';
|
} from '../api/CDPSession.js';
|
||||||
|
import {TargetCloseError} from '../common/Errors.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@ -12,7 +13,6 @@ import {
|
|||||||
type Connection,
|
type Connection,
|
||||||
createProtocolErrorMessage,
|
createProtocolErrorMessage,
|
||||||
} from './Connection.js';
|
} from './Connection.js';
|
||||||
import {TargetCloseError} from './Errors.js';
|
|
||||||
import {type CdpTarget} from './Target.js';
|
import {type CdpTarget} from './Target.js';
|
||||||
|
|
||||||
/**
|
/**
|
@ -19,11 +19,12 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
import {type TargetFilterCallback} from '../api/Browser.js';
|
import {type TargetFilterCallback} from '../api/Browser.js';
|
||||||
import {CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
import {TargetType} from '../api/Target.js';
|
import {TargetType} from '../api/Target.js';
|
||||||
|
import {EventEmitter} from '../common/EventEmitter.js';
|
||||||
|
import {debugError} from '../common/util.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 {type Connection} from './Connection.js';
|
import {type Connection} from './Connection.js';
|
||||||
import {EventEmitter} from './EventEmitter.js';
|
|
||||||
import {CdpTarget, InitializationStatus} from './Target.js';
|
import {CdpTarget, InitializationStatus} from './Target.js';
|
||||||
import {
|
import {
|
||||||
type TargetFactory,
|
type TargetFactory,
|
||||||
@ -31,7 +32,6 @@ import {
|
|||||||
TargetManagerEvent,
|
TargetManagerEvent,
|
||||||
type TargetManagerEvents,
|
type TargetManagerEvents,
|
||||||
} from './TargetManager.js';
|
} from './TargetManager.js';
|
||||||
import {debugError} from './util.js';
|
|
||||||
|
|
||||||
function isTargetExposed(target: CdpTarget): boolean {
|
function isTargetExposed(target: CdpTarget): boolean {
|
||||||
return target.type() !== TargetType.TAB && !target._subtype();
|
return target.type() !== TargetType.TAB && !target._subtype();
|
@ -22,14 +22,14 @@ import {
|
|||||||
CDPSessionEvent,
|
CDPSessionEvent,
|
||||||
type CDPSessionEvents,
|
type CDPSessionEvents,
|
||||||
} from '../api/CDPSession.js';
|
} from '../api/CDPSession.js';
|
||||||
|
import {ConnectionTransport} from '../common/ConnectionTransport.js';
|
||||||
|
import {debug} from '../common/Debug.js';
|
||||||
|
import {ProtocolError, TargetCloseError} from '../common/Errors.js';
|
||||||
|
import {EventEmitter} from '../common/EventEmitter.js';
|
||||||
|
import {debugError} from '../common/util.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
import {CdpCDPSession} from './CDPSession.js';
|
import {CdpCDPSession} from './CDPSession.js';
|
||||||
import {ConnectionTransport} from './ConnectionTransport.js';
|
|
||||||
import {debug} from './Debug.js';
|
|
||||||
import {ProtocolError, TargetCloseError} from './Errors.js';
|
|
||||||
import {EventEmitter} from './EventEmitter.js';
|
|
||||||
import {debugError} from './util.js';
|
|
||||||
|
|
||||||
const debugProtocolSend = debug('puppeteer:protocol:SEND ►');
|
const debugProtocolSend = debug('puppeteer:protocol:SEND ►');
|
||||||
const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀');
|
const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀');
|
@ -17,11 +17,10 @@
|
|||||||
import {type Protocol} from 'devtools-protocol';
|
import {type Protocol} from 'devtools-protocol';
|
||||||
|
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
|
import {EventSubscription} from '../common/EventEmitter.js';
|
||||||
|
import {debugError, PuppeteerURL} from '../common/util.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
|
|
||||||
import {EventSubscription} from './EventEmitter.js';
|
|
||||||
import {debugError, PuppeteerURL} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CoverageEntry class represents one entry of the coverage report.
|
* The CoverageEntry class represents one entry of the coverage report.
|
||||||
* @public
|
* @public
|
@ -19,15 +19,15 @@ import {describe, it} from 'node:test';
|
|||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
|
||||||
import {type CDPSessionEvents} from '../api/CDPSession.js';
|
import {type CDPSessionEvents} from '../api/CDPSession.js';
|
||||||
|
import {TimeoutError} from '../common/Errors.js';
|
||||||
|
import {EventEmitter} from '../common/EventEmitter.js';
|
||||||
|
import {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
DeviceRequestPrompt,
|
DeviceRequestPrompt,
|
||||||
DeviceRequestPromptDevice,
|
DeviceRequestPromptDevice,
|
||||||
DeviceRequestPromptManager,
|
DeviceRequestPromptManager,
|
||||||
} from './DeviceRequestPrompt.js';
|
} from './DeviceRequestPrompt.js';
|
||||||
import {TimeoutError} from './Errors.js';
|
|
||||||
import {EventEmitter} from './EventEmitter.js';
|
|
||||||
import {TimeoutSettings} from './TimeoutSettings.js';
|
|
||||||
|
|
||||||
class MockCDPSession extends EventEmitter<CDPSessionEvents> {
|
class MockCDPSession extends EventEmitter<CDPSessionEvents> {
|
||||||
async send(): Promise<any> {}
|
async send(): Promise<any> {}
|
@ -18,11 +18,10 @@ import type Protocol from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type WaitTimeoutOptions} from '../api/Page.js';
|
import {type WaitTimeoutOptions} from '../api/Page.js';
|
||||||
|
import {type TimeoutSettings} from '../common/TimeoutSettings.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 {type TimeoutSettings} from './TimeoutSettings.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Device in a request prompt.
|
* Device in a request prompt.
|
||||||
*
|
*
|
@ -19,6 +19,7 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type AutofillData, ElementHandle} from '../api/ElementHandle.js';
|
import {type AutofillData, ElementHandle} from '../api/ElementHandle.js';
|
||||||
import {type Page, type ScreenshotOptions} from '../api/Page.js';
|
import {type Page, type ScreenshotOptions} from '../api/Page.js';
|
||||||
|
import {debugError} from '../common/util.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {throwIfDisposed} from '../util/decorators.js';
|
import {throwIfDisposed} from '../util/decorators.js';
|
||||||
|
|
||||||
@ -26,7 +27,6 @@ import {type CdpFrame} from './Frame.js';
|
|||||||
import {type FrameManager} from './FrameManager.js';
|
import {type FrameManager} from './FrameManager.js';
|
||||||
import {type IsolatedWorld} from './IsolatedWorld.js';
|
import {type IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {CdpJSHandle} from './JSHandle.js';
|
import {CdpJSHandle} from './JSHandle.js';
|
||||||
import {debugError} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CdpElementHandle extends ElementHandle now to keep compatibility
|
* The CdpElementHandle extends ElementHandle now to keep compatibility
|
@ -17,13 +17,12 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
import {type GeolocationOptions, type MediaFeature} from '../api/Page.js';
|
import {type GeolocationOptions, type MediaFeature} from '../api/Page.js';
|
||||||
|
import {debugError} from '../common/util.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
import {invokeAtMostOnceForArguments} from '../util/decorators.js';
|
import {invokeAtMostOnceForArguments} from '../util/decorators.js';
|
||||||
import {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
|
|
||||||
import {type Viewport} from './PuppeteerViewport.js';
|
|
||||||
import {debugError} from './util.js';
|
|
||||||
|
|
||||||
interface ViewportState {
|
interface ViewportState {
|
||||||
viewport?: Viewport;
|
viewport?: Viewport;
|
||||||
active: boolean;
|
active: boolean;
|
@ -19,6 +19,17 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import type {ElementHandle} from '../api/ElementHandle.js';
|
import type {ElementHandle} from '../api/ElementHandle.js';
|
||||||
import {type JSHandle} from '../api/JSHandle.js';
|
import {type JSHandle} from '../api/JSHandle.js';
|
||||||
|
import {LazyArg} from '../common/LazyArg.js';
|
||||||
|
import {scriptInjector} from '../common/ScriptInjector.js';
|
||||||
|
import {type EvaluateFunc, type HandleFor} from '../common/types.js';
|
||||||
|
import {
|
||||||
|
PuppeteerURL,
|
||||||
|
createEvaluationError,
|
||||||
|
debugError,
|
||||||
|
getSourcePuppeteerURLIfAvailable,
|
||||||
|
isString,
|
||||||
|
valueFromRemoteObject,
|
||||||
|
} from '../common/util.js';
|
||||||
import type PuppeteerUtil from '../injected/injected.js';
|
import type PuppeteerUtil from '../injected/injected.js';
|
||||||
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
|
import {AsyncIterableUtil} from '../util/AsyncIterableUtil.js';
|
||||||
import {stringifyFunction} from '../util/Function.js';
|
import {stringifyFunction} from '../util/Function.js';
|
||||||
@ -28,17 +39,6 @@ import {Binding} from './Binding.js';
|
|||||||
import {CdpElementHandle} from './ElementHandle.js';
|
import {CdpElementHandle} from './ElementHandle.js';
|
||||||
import {type IsolatedWorld} from './IsolatedWorld.js';
|
import {type IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {CdpJSHandle} from './JSHandle.js';
|
import {CdpJSHandle} from './JSHandle.js';
|
||||||
import {LazyArg} from './LazyArg.js';
|
|
||||||
import {scriptInjector} from './ScriptInjector.js';
|
|
||||||
import {type EvaluateFunc, type HandleFor} from './types.js';
|
|
||||||
import {
|
|
||||||
PuppeteerURL,
|
|
||||||
createEvaluationError,
|
|
||||||
createCdpHandle,
|
|
||||||
getSourcePuppeteerURLIfAvailable,
|
|
||||||
isString,
|
|
||||||
valueFromRemoteObject,
|
|
||||||
} from './util.js';
|
|
||||||
|
|
||||||
const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
|
const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
|
||||||
|
|
||||||
@ -391,3 +391,35 @@ const rewriteError = (error: Error): Protocol.Runtime.EvaluateResponse => {
|
|||||||
}
|
}
|
||||||
throw error;
|
throw error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export function createCdpHandle(
|
||||||
|
realm: IsolatedWorld,
|
||||||
|
remoteObject: Protocol.Runtime.RemoteObject
|
||||||
|
): JSHandle | ElementHandle<Node> {
|
||||||
|
if (remoteObject.subtype === 'node') {
|
||||||
|
return new CdpElementHandle(realm, remoteObject);
|
||||||
|
}
|
||||||
|
return new CdpJSHandle(realm, remoteObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export async function releaseObject(
|
||||||
|
client: CDPSession,
|
||||||
|
remoteObject: Protocol.Runtime.RemoteObject
|
||||||
|
): Promise<void> {
|
||||||
|
if (!remoteObject.objectId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await client
|
||||||
|
.send('Runtime.releaseObject', {objectId: remoteObject.objectId})
|
||||||
|
.catch(error => {
|
||||||
|
// Exceptions might happen in case of a page been navigated or closed.
|
||||||
|
// Swallow these since they are harmless and we don't leak anything in this case.
|
||||||
|
debugError(error);
|
||||||
|
});
|
||||||
|
}
|
@ -18,11 +18,11 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type TargetFilterCallback} from '../api/Browser.js';
|
import {type TargetFilterCallback} from '../api/Browser.js';
|
||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
|
import {EventEmitter} from '../common/EventEmitter.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 {type Connection} from './Connection.js';
|
import {type Connection} from './Connection.js';
|
||||||
import {EventEmitter} from './EventEmitter.js';
|
|
||||||
import {type CdpTarget} from './Target.js';
|
import {type CdpTarget} from './Target.js';
|
||||||
import {
|
import {
|
||||||
type TargetFactory,
|
type TargetFactory,
|
@ -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 Page, type WaitTimeoutOptions} from '../api/Page.js';
|
import {type Page, type WaitTimeoutOptions} from '../api/Page.js';
|
||||||
|
import {setPageContent} from '../common/util.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 {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
@ -35,7 +36,6 @@ import {
|
|||||||
LifecycleWatcher,
|
LifecycleWatcher,
|
||||||
type PuppeteerLifeCycleEvent,
|
type PuppeteerLifeCycleEvent,
|
||||||
} from './LifecycleWatcher.js';
|
} from './LifecycleWatcher.js';
|
||||||
import {setPageContent} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -19,6 +19,9 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
import {FrameEvent} from '../api/Frame.js';
|
import {FrameEvent} from '../api/Frame.js';
|
||||||
import {type Page} from '../api/Page.js';
|
import {type Page} from '../api/Page.js';
|
||||||
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
|
import {type TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
|
import {debugError, PuppeteerURL} from '../common/util.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 {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
@ -26,7 +29,6 @@ import {isErrorLike} from '../util/ErrorLike.js';
|
|||||||
import {CdpCDPSession} from './CDPSession.js';
|
import {CdpCDPSession} from './CDPSession.js';
|
||||||
import {isTargetClosedError} from './Connection.js';
|
import {isTargetClosedError} from './Connection.js';
|
||||||
import {DeviceRequestPromptManager} from './DeviceRequestPrompt.js';
|
import {DeviceRequestPromptManager} from './DeviceRequestPrompt.js';
|
||||||
import {EventEmitter, type EventType} from './EventEmitter.js';
|
|
||||||
import {ExecutionContext} from './ExecutionContext.js';
|
import {ExecutionContext} from './ExecutionContext.js';
|
||||||
import {CdpFrame} from './Frame.js';
|
import {CdpFrame} from './Frame.js';
|
||||||
import {FrameTree} from './FrameTree.js';
|
import {FrameTree} from './FrameTree.js';
|
||||||
@ -34,8 +36,6 @@ import {type IsolatedWorld} from './IsolatedWorld.js';
|
|||||||
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
import {MAIN_WORLD, PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||||
import {NetworkManager} from './NetworkManager.js';
|
import {NetworkManager} from './NetworkManager.js';
|
||||||
import {type CdpTarget} from './Target.js';
|
import {type CdpTarget} from './Target.js';
|
||||||
import {type TimeoutSettings} from './TimeoutSettings.js';
|
|
||||||
import {debugError, PuppeteerURL} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -29,11 +29,10 @@ import {
|
|||||||
STATUS_TEXTS,
|
STATUS_TEXTS,
|
||||||
} from '../api/HTTPRequest.js';
|
} from '../api/HTTPRequest.js';
|
||||||
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
|
import {type ProtocolError} from '../common/Errors.js';
|
||||||
|
import {debugError, isString} from '../common/util.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
|
|
||||||
import {type ProtocolError} from './Errors.js';
|
|
||||||
import {debugError, isString} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
@ -18,11 +18,11 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type Frame} from '../api/Frame.js';
|
import {type Frame} from '../api/Frame.js';
|
||||||
import {HTTPResponse, type RemoteAddress} from '../api/HTTPResponse.js';
|
import {HTTPResponse, type RemoteAddress} from '../api/HTTPResponse.js';
|
||||||
|
import {ProtocolError} from '../common/Errors.js';
|
||||||
|
import {SecurityDetails} from '../common/SecurityDetails.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
import {ProtocolError} from './Errors.js';
|
|
||||||
import {type CdpHTTPRequest} from './HTTPRequest.js';
|
import {type CdpHTTPRequest} from './HTTPRequest.js';
|
||||||
import {SecurityDetails} from './SecurityDetails.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -31,13 +31,12 @@ import {
|
|||||||
Touchscreen,
|
Touchscreen,
|
||||||
type KeyboardTypeOptions,
|
type KeyboardTypeOptions,
|
||||||
} from '../api/Input.js';
|
} from '../api/Input.js';
|
||||||
import {assert} from '../util/assert.js';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
_keyDefinitions,
|
_keyDefinitions,
|
||||||
type KeyDefinition,
|
type KeyDefinition,
|
||||||
type KeyInput,
|
type KeyInput,
|
||||||
} from './USKeyboardLayout.js';
|
} from '../common/USKeyboardLayout.js';
|
||||||
|
import {assert} from '../util/assert.js';
|
||||||
|
|
||||||
type KeyDescription = Required<
|
type KeyDescription = Required<
|
||||||
Pick<KeyDefinition, 'keyCode' | 'key' | 'text' | 'code' | 'location'>
|
Pick<KeyDefinition, 'keyCode' | 'key' | 'text' | 'code' | 'location'>
|
@ -19,58 +19,25 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type JSHandle} from '../api/JSHandle.js';
|
import {type JSHandle} from '../api/JSHandle.js';
|
||||||
import {Realm} from '../api/Realm.js';
|
import {Realm} from '../api/Realm.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {type TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
|
|
||||||
import {type Binding} from './Binding.js';
|
|
||||||
import {type ExecutionContext} from './ExecutionContext.js';
|
|
||||||
import {CdpFrame} from './Frame.js';
|
|
||||||
import {type MAIN_WORLD, type PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
|
||||||
import {type TimeoutSettings} from './TimeoutSettings.js';
|
|
||||||
import {
|
import {
|
||||||
type BindingPayload,
|
type BindingPayload,
|
||||||
type EvaluateFunc,
|
type EvaluateFunc,
|
||||||
type HandleFor,
|
type HandleFor,
|
||||||
} from './types.js';
|
} from '../common/types.js';
|
||||||
import {
|
import {
|
||||||
addPageBinding,
|
|
||||||
createCdpHandle,
|
|
||||||
debugError,
|
|
||||||
Mutex,
|
Mutex,
|
||||||
|
addPageBinding,
|
||||||
|
debugError,
|
||||||
withSourcePuppeteerURLIfNone,
|
withSourcePuppeteerURLIfNone,
|
||||||
} from './util.js';
|
} from '../common/util.js';
|
||||||
import {type WebWorker} from './WebWorker.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
/**
|
import {type Binding} from './Binding.js';
|
||||||
* @public
|
import {type ExecutionContext, createCdpHandle} from './ExecutionContext.js';
|
||||||
*/
|
import {CdpFrame} from './Frame.js';
|
||||||
export interface WaitForSelectorOptions {
|
import {type MAIN_WORLD, type PUPPETEER_WORLD} from './IsolatedWorlds.js';
|
||||||
/**
|
import {type WebWorker} from './WebWorker.js';
|
||||||
* Wait for the selected element to be present in DOM and to be visible, i.e.
|
|
||||||
* to not have `display: none` or `visibility: hidden` CSS properties.
|
|
||||||
*
|
|
||||||
* @defaultValue `false`
|
|
||||||
*/
|
|
||||||
visible?: boolean;
|
|
||||||
/**
|
|
||||||
* Wait for the selected element to not be found in the DOM or to be hidden,
|
|
||||||
* i.e. have `display: none` or `visibility: hidden` CSS properties.
|
|
||||||
*
|
|
||||||
* @defaultValue `false`
|
|
||||||
*/
|
|
||||||
hidden?: boolean;
|
|
||||||
/**
|
|
||||||
* Maximum time to wait in milliseconds. Pass `0` to disable timeout.
|
|
||||||
*
|
|
||||||
* The default value can be changed by using {@link Page.setDefaultTimeout}
|
|
||||||
*
|
|
||||||
* @defaultValue `30_000` (30 seconds)
|
|
||||||
*/
|
|
||||||
timeout?: number;
|
|
||||||
/**
|
|
||||||
* A signal object that allows you to cancel a waitForSelector call.
|
|
||||||
*/
|
|
||||||
signal?: AbortSignal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -18,10 +18,11 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {JSHandle} from '../api/JSHandle.js';
|
import {JSHandle} from '../api/JSHandle.js';
|
||||||
|
import {valueFromRemoteObject} from '../common/util.js';
|
||||||
|
|
||||||
import type {CdpElementHandle} from './ElementHandle.js';
|
import type {CdpElementHandle} from './ElementHandle.js';
|
||||||
|
import {releaseObject} from './ExecutionContext.js';
|
||||||
import {type IsolatedWorld} from './IsolatedWorld.js';
|
import {type IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {releaseObject, valueFromRemoteObject} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
@ -18,11 +18,11 @@ import type Protocol from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type Frame, FrameEvent} from '../api/Frame.js';
|
import {type Frame, FrameEvent} from '../api/Frame.js';
|
||||||
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
|
import {type TimeoutError} from '../common/Errors.js';
|
||||||
|
import {EventSubscription} from '../common/EventEmitter.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 {type TimeoutError} from './Errors.js';
|
|
||||||
import {EventSubscription} from './EventEmitter.js';
|
|
||||||
import {type CdpFrame} from './Frame.js';
|
import {type CdpFrame} from './Frame.js';
|
||||||
import {FrameManagerEvent} from './FrameManager.js';
|
import {FrameManagerEvent} from './FrameManager.js';
|
||||||
import {type CdpHTTPRequest} from './HTTPRequest.js';
|
import {type CdpHTTPRequest} from './HTTPRequest.js';
|
@ -21,8 +21,8 @@ import expect from 'expect';
|
|||||||
import {type CDPSessionEvents} from '../api/CDPSession.js';
|
import {type CDPSessionEvents} from '../api/CDPSession.js';
|
||||||
import {type HTTPRequest} from '../api/HTTPRequest.js';
|
import {type HTTPRequest} from '../api/HTTPRequest.js';
|
||||||
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
import {type HTTPResponse} from '../api/HTTPResponse.js';
|
||||||
|
import {EventEmitter} from '../common/EventEmitter.js';
|
||||||
|
|
||||||
import {EventEmitter} from './EventEmitter.js';
|
|
||||||
import {type CdpFrame} from './Frame.js';
|
import {type CdpFrame} from './Frame.js';
|
||||||
import {NetworkManager, NetworkManagerEvent} from './NetworkManager.js';
|
import {NetworkManager, NetworkManagerEvent} from './NetworkManager.js';
|
||||||
|
|
@ -18,20 +18,20 @@ import type {Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
import {type CDPSession, CDPSessionEvent} from '../api/CDPSession.js';
|
||||||
import type {Frame} from '../api/Frame.js';
|
import type {Frame} from '../api/Frame.js';
|
||||||
import {assert} from '../util/assert.js';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
EventEmitter,
|
EventEmitter,
|
||||||
EventSubscription,
|
EventSubscription,
|
||||||
type EventType,
|
type EventType,
|
||||||
} from './EventEmitter.js';
|
} from '../common/EventEmitter.js';
|
||||||
|
import {debugError, isString} from '../common/util.js';
|
||||||
|
import {assert} from '../util/assert.js';
|
||||||
|
|
||||||
import {CdpHTTPRequest} from './HTTPRequest.js';
|
import {CdpHTTPRequest} from './HTTPRequest.js';
|
||||||
import {CdpHTTPResponse} from './HTTPResponse.js';
|
import {CdpHTTPResponse} from './HTTPResponse.js';
|
||||||
import {
|
import {
|
||||||
type FetchRequestId,
|
type FetchRequestId,
|
||||||
NetworkEventManager,
|
NetworkEventManager,
|
||||||
} from './NetworkEventManager.js';
|
} from './NetworkEventManager.js';
|
||||||
import {debugError, isString} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -52,6 +52,7 @@ export interface NetworkConditions {
|
|||||||
// Latency (ms)
|
// Latency (ms)
|
||||||
latency: number;
|
latency: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
@ -38,6 +38,30 @@ import {
|
|||||||
type WaitForOptions,
|
type WaitForOptions,
|
||||||
type WaitTimeoutOptions,
|
type WaitTimeoutOptions,
|
||||||
} from '../api/Page.js';
|
} from '../api/Page.js';
|
||||||
|
import {
|
||||||
|
ConsoleMessage,
|
||||||
|
type ConsoleMessageType,
|
||||||
|
} from '../common/ConsoleMessage.js';
|
||||||
|
import {TargetCloseError} from '../common/Errors.js';
|
||||||
|
import {FileChooser} from '../common/FileChooser.js';
|
||||||
|
import {type PDFOptions} from '../common/PDFOptions.js';
|
||||||
|
import {type TaskQueue} from '../common/TaskQueue.js';
|
||||||
|
import {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
|
import {type BindingPayload, type HandleFor} from '../common/types.js';
|
||||||
|
import {
|
||||||
|
createClientError,
|
||||||
|
debugError,
|
||||||
|
evaluationString,
|
||||||
|
getReadableAsBuffer,
|
||||||
|
getReadableFromProtocolStream,
|
||||||
|
isString,
|
||||||
|
pageBindingInitString,
|
||||||
|
validateDialogType,
|
||||||
|
valueFromRemoteObject,
|
||||||
|
waitForEvent,
|
||||||
|
waitWithTimeout,
|
||||||
|
} from '../common/util.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.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 {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
@ -46,13 +70,11 @@ import {Accessibility} from './Accessibility.js';
|
|||||||
import {Binding} from './Binding.js';
|
import {Binding} from './Binding.js';
|
||||||
import {CdpCDPSession} from './CDPSession.js';
|
import {CdpCDPSession} from './CDPSession.js';
|
||||||
import {isTargetClosedError} from './Connection.js';
|
import {isTargetClosedError} from './Connection.js';
|
||||||
import {ConsoleMessage, type ConsoleMessageType} from './ConsoleMessage.js';
|
|
||||||
import {Coverage} from './Coverage.js';
|
import {Coverage} from './Coverage.js';
|
||||||
import {type DeviceRequestPrompt} from './DeviceRequestPrompt.js';
|
import {type DeviceRequestPrompt} from './DeviceRequestPrompt.js';
|
||||||
import {CdpDialog} from './Dialog.js';
|
import {CdpDialog} from './Dialog.js';
|
||||||
import {EmulationManager} from './EmulationManager.js';
|
import {EmulationManager} from './EmulationManager.js';
|
||||||
import {TargetCloseError} from './Errors.js';
|
import {createCdpHandle, releaseObject} from './ExecutionContext.js';
|
||||||
import {FileChooser} from './FileChooser.js';
|
|
||||||
import {type CdpFrame} from './Frame.js';
|
import {type CdpFrame} from './Frame.js';
|
||||||
import {FrameManager, FrameManagerEvent} from './FrameManager.js';
|
import {FrameManager, FrameManagerEvent} from './FrameManager.js';
|
||||||
import {CdpKeyboard, CdpMouse, CdpTouchscreen} from './Input.js';
|
import {CdpKeyboard, CdpMouse, CdpTouchscreen} from './Input.js';
|
||||||
@ -62,29 +84,9 @@ import {
|
|||||||
type NetworkConditions,
|
type NetworkConditions,
|
||||||
NetworkManagerEvent,
|
NetworkManagerEvent,
|
||||||
} from './NetworkManager.js';
|
} from './NetworkManager.js';
|
||||||
import {type PDFOptions} from './PDFOptions.js';
|
|
||||||
import {type Viewport} from './PuppeteerViewport.js';
|
|
||||||
import {type CdpTarget} from './Target.js';
|
import {type CdpTarget} from './Target.js';
|
||||||
import {TargetManagerEvent} from './TargetManager.js';
|
import {TargetManagerEvent} from './TargetManager.js';
|
||||||
import {type TaskQueue} from './TaskQueue.js';
|
|
||||||
import {TimeoutSettings} from './TimeoutSettings.js';
|
|
||||||
import {Tracing} from './Tracing.js';
|
import {Tracing} from './Tracing.js';
|
||||||
import {type BindingPayload, type HandleFor} from './types.js';
|
|
||||||
import {
|
|
||||||
createCdpHandle,
|
|
||||||
createClientError,
|
|
||||||
debugError,
|
|
||||||
evaluationString,
|
|
||||||
getReadableAsBuffer,
|
|
||||||
getReadableFromProtocolStream,
|
|
||||||
isString,
|
|
||||||
pageBindingInitString,
|
|
||||||
releaseObject,
|
|
||||||
validateDialogType,
|
|
||||||
valueFromRemoteObject,
|
|
||||||
waitForEvent,
|
|
||||||
waitWithTimeout,
|
|
||||||
} from './util.js';
|
|
||||||
import {WebWorker} from './WebWorker.js';
|
import {WebWorker} from './WebWorker.js';
|
||||||
|
|
||||||
/**
|
/**
|
@ -15,16 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {type Browser} from '../api/Browser.js';
|
import {type Browser} from '../api/Browser.js';
|
||||||
|
import {type ConnectionTransport} from '../common/ConnectionTransport.js';
|
||||||
|
import {
|
||||||
|
type CustomQueryHandler,
|
||||||
|
customQueryHandlers,
|
||||||
|
} from '../common/CustomQueryHandler.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type BrowserConnectOptions,
|
type BrowserConnectOptions,
|
||||||
_connectToCdpBrowser,
|
_connectToCdpBrowser,
|
||||||
} from './BrowserConnector.js';
|
} from './BrowserConnector.js';
|
||||||
import {type ConnectionTransport} from './ConnectionTransport.js';
|
|
||||||
import {
|
|
||||||
type CustomQueryHandler,
|
|
||||||
customQueryHandlers,
|
|
||||||
} from './CustomQueryHandler.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings that are common to the Puppeteer class, regardless of environment.
|
* Settings that are common to the Puppeteer class, regardless of environment.
|
@ -21,14 +21,14 @@ import type {BrowserContext} from '../api/BrowserContext.js';
|
|||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type Page, PageEvent} from '../api/Page.js';
|
import {type Page, PageEvent} from '../api/Page.js';
|
||||||
import {Target, TargetType} from '../api/Target.js';
|
import {Target, TargetType} from '../api/Target.js';
|
||||||
|
import {type TaskQueue} from '../common/TaskQueue.js';
|
||||||
|
import {debugError} from '../common/util.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
import {Deferred} from '../util/Deferred.js';
|
import {Deferred} from '../util/Deferred.js';
|
||||||
|
|
||||||
import {CdpCDPSession} from './CDPSession.js';
|
import {CdpCDPSession} from './CDPSession.js';
|
||||||
import {CdpPage} from './Page.js';
|
import {CdpPage} from './Page.js';
|
||||||
import {type Viewport} from './PuppeteerViewport.js';
|
|
||||||
import {type TargetManager} from './TargetManager.js';
|
import {type TargetManager} from './TargetManager.js';
|
||||||
import {type TaskQueue} from './TaskQueue.js';
|
|
||||||
import {debugError} from './util.js';
|
|
||||||
import {WebWorker} from './WebWorker.js';
|
import {WebWorker} from './WebWorker.js';
|
||||||
|
|
||||||
/**
|
/**
|
@ -17,8 +17,8 @@
|
|||||||
import {type Protocol} from 'devtools-protocol';
|
import {type Protocol} from 'devtools-protocol';
|
||||||
|
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
|
import {type EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
|
|
||||||
import {type EventEmitter, type EventType} from './EventEmitter.js';
|
|
||||||
import {type CdpTarget} from './Target.js';
|
import {type CdpTarget} from './Target.js';
|
||||||
|
|
||||||
/**
|
/**
|
@ -14,12 +14,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
|
import {
|
||||||
|
getReadableAsBuffer,
|
||||||
|
getReadableFromProtocolStream,
|
||||||
|
} from '../common/util.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 {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
|
|
||||||
import {getReadableAsBuffer, getReadableFromProtocolStream} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
@ -17,15 +17,15 @@ import {type Protocol} from 'devtools-protocol';
|
|||||||
|
|
||||||
import {type CDPSession} from '../api/CDPSession.js';
|
import {type CDPSession} from '../api/CDPSession.js';
|
||||||
import {type Realm} from '../api/Realm.js';
|
import {type Realm} from '../api/Realm.js';
|
||||||
|
import {type ConsoleMessageType} from '../common/ConsoleMessage.js';
|
||||||
|
import {EventEmitter, type EventType} from '../common/EventEmitter.js';
|
||||||
|
import {TimeoutSettings} from '../common/TimeoutSettings.js';
|
||||||
|
import {type EvaluateFunc, type HandleFor} from '../common/types.js';
|
||||||
|
import {debugError, withSourcePuppeteerURLIfNone} from '../common/util.js';
|
||||||
|
|
||||||
import {type ConsoleMessageType} from './ConsoleMessage.js';
|
|
||||||
import {EventEmitter, type EventType} from './EventEmitter.js';
|
|
||||||
import {ExecutionContext} from './ExecutionContext.js';
|
import {ExecutionContext} from './ExecutionContext.js';
|
||||||
import {IsolatedWorld} from './IsolatedWorld.js';
|
import {IsolatedWorld} from './IsolatedWorld.js';
|
||||||
import {CdpJSHandle} from './JSHandle.js';
|
import {CdpJSHandle} from './JSHandle.js';
|
||||||
import {TimeoutSettings} from './TimeoutSettings.js';
|
|
||||||
import {type EvaluateFunc, type HandleFor} from './types.js';
|
|
||||||
import {debugError, withSourcePuppeteerURLIfNone} from './util.js';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
51
packages/puppeteer-core/src/cdp/cdp.ts
Normal file
51
packages/puppeteer-core/src/cdp/cdp.ts
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export * from './Accessibility.js';
|
||||||
|
export * from './AriaQueryHandler.js';
|
||||||
|
export * from './Binding.js';
|
||||||
|
export * from './Browser.js';
|
||||||
|
export * from './BrowserConnector.js';
|
||||||
|
export * from './CDPSession.js';
|
||||||
|
export * from './ChromeTargetManager.js';
|
||||||
|
export * from './Connection.js';
|
||||||
|
export * from './Coverage.js';
|
||||||
|
export * from './DeviceRequestPrompt.js';
|
||||||
|
export * from './Dialog.js';
|
||||||
|
export * from './ElementHandle.js';
|
||||||
|
export * from './EmulationManager.js';
|
||||||
|
export * from './ExecutionContext.js';
|
||||||
|
export * from './FirefoxTargetManager.js';
|
||||||
|
export * from './Frame.js';
|
||||||
|
export * from './FrameManager.js';
|
||||||
|
export * from './FrameTree.js';
|
||||||
|
export * from './HTTPRequest.js';
|
||||||
|
export * from './HTTPResponse.js';
|
||||||
|
export * from './Input.js';
|
||||||
|
export * from './IsolatedWorld.js';
|
||||||
|
export * from './IsolatedWorlds.js';
|
||||||
|
export * from './JSHandle.js';
|
||||||
|
export * from './LifecycleWatcher.js';
|
||||||
|
export * from './NetworkEventManager.js';
|
||||||
|
export * from './NetworkManager.js';
|
||||||
|
export * from './Page.js';
|
||||||
|
export * from './PredefinedNetworkConditions.js';
|
||||||
|
export * from './Puppeteer.js';
|
||||||
|
export * from './Target.js';
|
||||||
|
export * from './TargetManager.js';
|
||||||
|
export * from './Tracing.js';
|
||||||
|
export * from './WebWorker.js';
|
||||||
|
export * from './cdp.js';
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {type Viewport} from './PuppeteerViewport.js';
|
import {type Viewport} from './Viewport.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {ARIAQueryHandler} from './AriaQueryHandler.js';
|
import {ARIAQueryHandler} from '../cdp/AriaQueryHandler.js';
|
||||||
|
|
||||||
import {customQueryHandlers} from './CustomQueryHandler.js';
|
import {customQueryHandlers} from './CustomQueryHandler.js';
|
||||||
import {PierceQueryHandler} from './PierceQueryHandler.js';
|
import {PierceQueryHandler} from './PierceQueryHandler.js';
|
||||||
import {PQueryHandler} from './PQueryHandler.js';
|
import {PQueryHandler} from './PQueryHandler.js';
|
||||||
@ -22,6 +23,9 @@ import type {QueryHandler} from './QueryHandler.js';
|
|||||||
import {TextQueryHandler} from './TextQueryHandler.js';
|
import {TextQueryHandler} from './TextQueryHandler.js';
|
||||||
import {XPathQueryHandler} from './XPathQueryHandler.js';
|
import {XPathQueryHandler} from './XPathQueryHandler.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
export const BUILTIN_QUERY_HANDLERS = Object.freeze({
|
export const BUILTIN_QUERY_HANDLERS = Object.freeze({
|
||||||
aria: ARIAQueryHandler,
|
aria: ARIAQueryHandler,
|
||||||
pierce: PierceQueryHandler,
|
pierce: PierceQueryHandler,
|
||||||
|
@ -16,12 +16,12 @@
|
|||||||
|
|
||||||
import {ElementHandle} from '../api/ElementHandle.js';
|
import {ElementHandle} from '../api/ElementHandle.js';
|
||||||
import type {Frame} from '../api/Frame.js';
|
import type {Frame} from '../api/Frame.js';
|
||||||
|
import type {WaitForSelectorOptions} from '../api/Page.js';
|
||||||
import type PuppeteerUtil from '../injected/injected.js';
|
import type PuppeteerUtil from '../injected/injected.js';
|
||||||
import {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
import {interpolateFunction, stringifyFunction} from '../util/Function.js';
|
import {interpolateFunction, stringifyFunction} from '../util/Function.js';
|
||||||
|
|
||||||
import {transposeIterableHandle} from './HandleIterator.js';
|
import {transposeIterableHandle} from './HandleIterator.js';
|
||||||
import type {WaitForSelectorOptions} from './IsolatedWorld.js';
|
|
||||||
import {LazyArg} from './LazyArg.js';
|
import {LazyArg} from './LazyArg.js';
|
||||||
import type {Awaitable, AwaitableIterable} from './types.js';
|
import type {Awaitable, AwaitableIterable} from './types.js';
|
||||||
|
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* Sets the viewport of the page.
|
|
||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface Viewport {
|
export interface Viewport {
|
@ -14,61 +14,34 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export * from './Accessibility.js';
|
|
||||||
export * from './AriaQueryHandler.js';
|
|
||||||
export * from './Binding.js';
|
|
||||||
export * from './Browser.js';
|
|
||||||
export * from './BrowserConnector.js';
|
|
||||||
export * from './BrowserWebSocketTransport.js';
|
export * from './BrowserWebSocketTransport.js';
|
||||||
export * from './CDPSession.js';
|
|
||||||
export * from './ChromeTargetManager.js';
|
|
||||||
export * from './Configuration.js';
|
export * from './Configuration.js';
|
||||||
export * from './Connection.js';
|
|
||||||
export * from './ConnectionTransport.js';
|
export * from './ConnectionTransport.js';
|
||||||
export * from './ConsoleMessage.js';
|
export * from './ConsoleMessage.js';
|
||||||
export * from './Coverage.js';
|
|
||||||
export * from './CustomQueryHandler.js';
|
export * from './CustomQueryHandler.js';
|
||||||
export * from './Debug.js';
|
export * from './Debug.js';
|
||||||
export * from './Device.js';
|
export * from './Device.js';
|
||||||
export * from './DeviceRequestPrompt.js';
|
|
||||||
export * from './Dialog.js';
|
|
||||||
export * from './ElementHandle.js';
|
|
||||||
export * from './EmulationManager.js';
|
|
||||||
export * from './Errors.js';
|
export * from './Errors.js';
|
||||||
export * from './EventEmitter.js';
|
export * from './EventEmitter.js';
|
||||||
export * from './ExecutionContext.js';
|
|
||||||
export * from './FileChooser.js';
|
export * from './FileChooser.js';
|
||||||
export * from './FirefoxTargetManager.js';
|
export * from './GetQueryHandler.js';
|
||||||
export * from './Frame.js';
|
export * from './HandleIterator.js';
|
||||||
export * from './FrameManager.js';
|
|
||||||
export * from './FrameTree.js';
|
|
||||||
export * from './HTTPRequest.js';
|
|
||||||
export * from './HTTPResponse.js';
|
|
||||||
export * from './Input.js';
|
|
||||||
export * from './IsolatedWorld.js';
|
|
||||||
export * from './IsolatedWorlds.js';
|
|
||||||
export * from './JSHandle.js';
|
|
||||||
export * from './LazyArg.js';
|
export * from './LazyArg.js';
|
||||||
export * from './LifecycleWatcher.js';
|
|
||||||
export * from './NetworkEventManager.js';
|
|
||||||
export * from './NetworkManager.js';
|
|
||||||
export * from './NodeWebSocketTransport.js';
|
|
||||||
export * from './PDFOptions.js';
|
export * from './PDFOptions.js';
|
||||||
export * from './Page.js';
|
export * from './PQueryHandler.js';
|
||||||
export * from './PredefinedNetworkConditions.js';
|
export * from './PierceQueryHandler.js';
|
||||||
export * from './Product.js';
|
export * from './Product.js';
|
||||||
export * from './Puppeteer.js';
|
|
||||||
export * from './PuppeteerViewport.js';
|
|
||||||
export * from './QueryHandler.js';
|
export * from './QueryHandler.js';
|
||||||
|
export * from './ScriptInjector.js';
|
||||||
export * from './SecurityDetails.js';
|
export * from './SecurityDetails.js';
|
||||||
export * from './Target.js';
|
|
||||||
export * from './TargetManager.js';
|
|
||||||
export * from './TaskQueue.js';
|
export * from './TaskQueue.js';
|
||||||
|
export * from './TextQueryHandler.js';
|
||||||
export * from './TimeoutSettings.js';
|
export * from './TimeoutSettings.js';
|
||||||
export * from './Tracing.js';
|
|
||||||
export * from './USKeyboardLayout.js';
|
export * from './USKeyboardLayout.js';
|
||||||
|
export * from './Viewport.js';
|
||||||
export * from './WaitTask.js';
|
export * from './WaitTask.js';
|
||||||
export * from './WebWorker.js';
|
export * from './XPathQueryHandler.js';
|
||||||
|
export * from './common.js';
|
||||||
export * from './fetch.js';
|
export * from './fetch.js';
|
||||||
export * from './types.js';
|
export * from './types.js';
|
||||||
export * from './util.js';
|
export * from './util.js';
|
||||||
|
@ -25,8 +25,6 @@ import {
|
|||||||
type Observable,
|
type Observable,
|
||||||
} 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 {ElementHandle} from '../api/ElementHandle.js';
|
|
||||||
import type {JSHandle} from '../api/JSHandle.js';
|
|
||||||
import {type Page} from '../api/Page.js';
|
import {type Page} from '../api/Page.js';
|
||||||
import {isNode} from '../environment.js';
|
import {isNode} from '../environment.js';
|
||||||
import {assert} from '../util/assert.js';
|
import {assert} from '../util/assert.js';
|
||||||
@ -34,11 +32,8 @@ import {Deferred} from '../util/Deferred.js';
|
|||||||
import {isErrorLike} from '../util/ErrorLike.js';
|
import {isErrorLike} from '../util/ErrorLike.js';
|
||||||
|
|
||||||
import {debug} from './Debug.js';
|
import {debug} from './Debug.js';
|
||||||
import {CdpElementHandle} from './ElementHandle.js';
|
|
||||||
import {TimeoutError} from './Errors.js';
|
import {TimeoutError} from './Errors.js';
|
||||||
import {EventSubscription} from './EventEmitter.js';
|
import {EventSubscription} from './EventEmitter.js';
|
||||||
import {type IsolatedWorld} from './IsolatedWorld.js';
|
|
||||||
import {CdpJSHandle} from './JSHandle.js';
|
|
||||||
import {type Awaitable} from './types.js';
|
import {type Awaitable} from './types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -293,25 +288,6 @@ export function valueFromRemoteObject(
|
|||||||
return remoteObject.value;
|
return remoteObject.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export async function releaseObject(
|
|
||||||
client: CDPSession,
|
|
||||||
remoteObject: Protocol.Runtime.RemoteObject
|
|
||||||
): Promise<void> {
|
|
||||||
if (!remoteObject.objectId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await client
|
|
||||||
.send('Runtime.releaseObject', {objectId: remoteObject.objectId})
|
|
||||||
.catch(error => {
|
|
||||||
// Exceptions might happen in case of a page been navigated or closed.
|
|
||||||
// Swallow these since they are harmless and we don't leak anything in this case.
|
|
||||||
debugError(error);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
@ -380,19 +356,6 @@ export async function waitForEvent<T>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*/
|
|
||||||
export function createCdpHandle(
|
|
||||||
realm: IsolatedWorld,
|
|
||||||
remoteObject: Protocol.Runtime.RemoteObject
|
|
||||||
): JSHandle | ElementHandle<Node> {
|
|
||||||
if (remoteObject.subtype === 'node') {
|
|
||||||
return new CdpElementHandle(realm, remoteObject);
|
|
||||||
}
|
|
||||||
return new CdpJSHandle(realm, remoteObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {type BrowserConnectOptions} from '../common/BrowserConnector.js';
|
import {type BrowserConnectOptions} from '../cdp/BrowserConnector.js';
|
||||||
import {type Product} from '../common/Product.js';
|
import {type Product} from '../common/Product.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,19 +27,19 @@ import {
|
|||||||
} from '@puppeteer/browsers';
|
} from '@puppeteer/browsers';
|
||||||
|
|
||||||
import {type Browser, type BrowserCloseCallback} from '../api/Browser.js';
|
import {type Browser, type BrowserCloseCallback} from '../api/Browser.js';
|
||||||
import {CdpBrowser} from '../common/Browser.js';
|
import {CdpBrowser} from '../cdp/Browser.js';
|
||||||
import {Connection} from '../common/Connection.js';
|
import {Connection} from '../cdp/Connection.js';
|
||||||
import {TimeoutError} from '../common/Errors.js';
|
import {TimeoutError} from '../common/Errors.js';
|
||||||
import {NodeWebSocketTransport as WebSocketTransport} from '../common/NodeWebSocketTransport.js';
|
|
||||||
import {type Product} from '../common/Product.js';
|
import {type Product} from '../common/Product.js';
|
||||||
import {type Viewport} from '../common/PuppeteerViewport.js';
|
|
||||||
import {debugError} from '../common/util.js';
|
import {debugError} from '../common/util.js';
|
||||||
|
import {type Viewport} from '../common/Viewport.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type BrowserLaunchArgumentOptions,
|
type BrowserLaunchArgumentOptions,
|
||||||
type ChromeReleaseChannel,
|
type ChromeReleaseChannel,
|
||||||
type PuppeteerNodeLaunchOptions,
|
type PuppeteerNodeLaunchOptions,
|
||||||
} from './LaunchOptions.js';
|
} from './LaunchOptions.js';
|
||||||
|
import {NodeWebSocketTransport as WebSocketTransport} from './NodeWebSocketTransport.js';
|
||||||
import {PipeTransport} from './PipeTransport.js';
|
import {PipeTransport} from './PipeTransport.js';
|
||||||
import {type PuppeteerNode} from './PuppeteerNode.js';
|
import {type PuppeteerNode} from './PuppeteerNode.js';
|
||||||
|
|
||||||
@ -335,9 +335,7 @@ export class ProductLauncher {
|
|||||||
}
|
}
|
||||||
): Promise<Browser> {
|
): Promise<Browser> {
|
||||||
// TODO: use other options too.
|
// TODO: use other options too.
|
||||||
const BiDi = await import(
|
const BiDi = await import(/* webpackIgnore: true */ '../bidi/bidi.js');
|
||||||
/* webpackIgnore: true */ '../common/bidi/bidi.js'
|
|
||||||
);
|
|
||||||
const bidiConnection = await BiDi.connectBidiOverCdp(connection);
|
const bidiConnection = await BiDi.connectBidiOverCdp(connection);
|
||||||
return await BiDi.BidiBrowser.create({
|
return await BiDi.BidiBrowser.create({
|
||||||
connection: bidiConnection,
|
connection: bidiConnection,
|
||||||
@ -368,9 +366,7 @@ export class ProductLauncher {
|
|||||||
opts.timeout
|
opts.timeout
|
||||||
)) + '/session';
|
)) + '/session';
|
||||||
const transport = await WebSocketTransport.create(browserWSEndpoint);
|
const transport = await WebSocketTransport.create(browserWSEndpoint);
|
||||||
const BiDi = await import(
|
const BiDi = await import(/* webpackIgnore: true */ '../bidi/bidi.js');
|
||||||
/* webpackIgnore: true */ '../common/bidi/bidi.js'
|
|
||||||
);
|
|
||||||
const bidiConnection = new BiDi.BidiConnection(
|
const bidiConnection = new BiDi.BidiConnection(
|
||||||
browserWSEndpoint,
|
browserWSEndpoint,
|
||||||
transport,
|
transport,
|
||||||
|
@ -23,14 +23,14 @@ import {
|
|||||||
} from '@puppeteer/browsers';
|
} from '@puppeteer/browsers';
|
||||||
|
|
||||||
import {type Browser} from '../api/Browser.js';
|
import {type Browser} from '../api/Browser.js';
|
||||||
import {type BrowserConnectOptions} from '../common/BrowserConnector.js';
|
import {type BrowserConnectOptions} from '../cdp/BrowserConnector.js';
|
||||||
import {type Configuration} from '../common/Configuration.js';
|
|
||||||
import {type Product} from '../common/Product.js';
|
|
||||||
import {
|
import {
|
||||||
type CommonPuppeteerSettings,
|
type CommonPuppeteerSettings,
|
||||||
type ConnectOptions,
|
type ConnectOptions,
|
||||||
Puppeteer,
|
Puppeteer,
|
||||||
} from '../common/Puppeteer.js';
|
} from '../cdp/Puppeteer.js';
|
||||||
|
import {type Configuration} from '../common/Configuration.js';
|
||||||
|
import {type Product} from '../common/Product.js';
|
||||||
import {PUPPETEER_REVISIONS} from '../revisions.js';
|
import {PUPPETEER_REVISIONS} from '../revisions.js';
|
||||||
|
|
||||||
import {ChromeLauncher} from './ChromeLauncher.js';
|
import {ChromeLauncher} from './ChromeLauncher.js';
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
export {Protocol} from 'devtools-protocol';
|
export {Protocol} from 'devtools-protocol';
|
||||||
|
|
||||||
export * from './api/api.js';
|
export * from './api/api.js';
|
||||||
|
export * from './cdp/cdp.js';
|
||||||
export * from './common/common.js';
|
export * from './common/common.js';
|
||||||
export * from './node/node.js';
|
export * from './node/node.js';
|
||||||
export * from './revisions.js';
|
export * from './revisions.js';
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
import {type CdpBrowser} from 'puppeteer-core/internal/common/Browser.js';
|
import {type CdpBrowser} from 'puppeteer-core/internal/cdp/Browser.js';
|
||||||
|
|
||||||
import {getTestState, launch} from './mocha-utils.js';
|
import {getTestState, launch} from './mocha-utils.js';
|
||||||
import {attachFrame} from './utils.js';
|
import {attachFrame} from './utils.js';
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import assert from 'assert';
|
import assert from 'assert';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
import {type SerializedAXNode} from 'puppeteer-core/internal/common/Accessibility.js';
|
import {type SerializedAXNode} from 'puppeteer-core/internal/cdp/Accessibility.js';
|
||||||
|
|
||||||
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
import {type BrowserContext} from 'puppeteer-core/internal/api/BrowserContext.js';
|
import {type BrowserContext} from 'puppeteer-core/internal/api/BrowserContext.js';
|
||||||
import {type CdpTarget} from 'puppeteer-core/internal/common/Target.js';
|
import {type CdpTarget} from 'puppeteer-core/internal/cdp/Target.js';
|
||||||
|
|
||||||
import {describeWithDebugLogs, getTestState, launch} from './mocha-utils.js';
|
import {describeWithDebugLogs, getTestState, launch} from './mocha-utils.js';
|
||||||
import {attachFrame, detachFrame, navigateFrame} from './utils.js';
|
import {attachFrame, detachFrame, navigateFrame} from './utils.js';
|
||||||
|
@ -22,8 +22,8 @@ import expect from 'expect';
|
|||||||
import {KnownDevices, TimeoutError} from 'puppeteer';
|
import {KnownDevices, TimeoutError} from 'puppeteer';
|
||||||
import {CDPSession} from 'puppeteer-core/internal/api/CDPSession.js';
|
import {CDPSession} from 'puppeteer-core/internal/api/CDPSession.js';
|
||||||
import {type Metrics, type Page} from 'puppeteer-core/internal/api/Page.js';
|
import {type Metrics, type Page} from 'puppeteer-core/internal/api/Page.js';
|
||||||
|
import {type CdpPage} from 'puppeteer-core/internal/cdp/Page.js';
|
||||||
import {type ConsoleMessage} from 'puppeteer-core/internal/common/ConsoleMessage.js';
|
import {type ConsoleMessage} from 'puppeteer-core/internal/common/ConsoleMessage.js';
|
||||||
import {type CdpPage} from 'puppeteer-core/internal/common/Page.js';
|
|
||||||
import sinon from 'sinon';
|
import sinon from 'sinon';
|
||||||
|
|
||||||
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
import {type WebWorker} from 'puppeteer-core/internal/cdp/WebWorker.js';
|
||||||
import {type ConsoleMessage} from 'puppeteer-core/internal/common/ConsoleMessage.js';
|
import {type ConsoleMessage} from 'puppeteer-core/internal/common/ConsoleMessage.js';
|
||||||
import {type WebWorker} from 'puppeteer-core/internal/common/WebWorker.js';
|
|
||||||
|
|
||||||
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
import {getTestState, setupTestBrowserHooks} from './mocha-utils.js';
|
||||||
import {waitEvent} from './utils.js';
|
import {waitEvent} from './utils.js';
|
||||||
|
Loading…
Reference in New Issue
Block a user