chrome-devtools-frontend 1.0.1020771 → 1.0.1022059
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +14 -1
- package/config/gni/devtools_grd_files.gni +15 -10
- package/docs/triage_guidelines.md +9 -7
- package/extension-api/ExtensionAPI.d.ts +54 -4
- package/front_end/.eslintrc.js +4 -1
- package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
- package/front_end/core/host/UserMetrics.ts +18 -0
- package/front_end/core/i18n/locales/en-US.json +150 -9
- package/front_end/core/i18n/locales/en-XL.json +150 -9
- package/front_end/core/sdk/CSSModel.ts +5 -2
- package/front_end/devtools_compatibility.js +1 -0
- package/front_end/legacy_test_runner/sources_test_runner/DebuggerTestRunner.js +4 -3
- package/front_end/models/bindings/BreakpointManager.ts +14 -3
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +165 -117
- package/front_end/models/bindings/ResourceScriptMapping.ts +76 -53
- package/front_end/models/extensions/ExtensionAPI.ts +101 -13
- package/front_end/models/extensions/ExtensionServer.ts +63 -1
- package/front_end/models/extensions/LanguageExtensionEndpoint.ts +16 -3
- package/front_end/models/timeline_model/TimelineModel.ts +164 -7
- package/front_end/panels/application/AppManifestView.ts +13 -2
- package/front_end/panels/application/ApplicationPanelSidebar.ts +67 -5
- package/front_end/panels/application/components/FrameDetailsView.ts +3 -2
- package/front_end/panels/application/components/Prerender2.ts +188 -0
- package/front_end/panels/application/components/protocolHandlersView.css +4 -0
- package/front_end/panels/elements/CSSRuleValidator.ts +103 -13
- package/front_end/panels/elements/ElementsPanel.ts +3 -0
- package/front_end/panels/elements/ElementsTreeElement.ts +3 -1
- package/front_end/panels/elements/ElementsTreeOutline.ts +41 -7
- package/front_end/panels/elements/LayoutSidebarPane.ts +1 -2
- package/front_end/panels/elements/StylePropertyTreeElement.ts +10 -8
- package/front_end/panels/elements/TopLayerContainer.ts +9 -1
- package/front_end/panels/elements/components/AdornerManager.ts +7 -0
- package/front_end/panels/elements/components/CSSHintDetailsView.ts +71 -0
- package/front_end/panels/elements/components/components.ts +2 -0
- package/front_end/panels/elements/components/cssHintDetailsView.css +36 -0
- package/front_end/panels/elements/elementsTreeOutline.css +4 -0
- package/front_end/panels/elements/stylesSectionTree.css +1 -1
- package/front_end/panels/network/components/RequestHeadersView.ts +2 -1
- package/front_end/services/puppeteer/PuppeteerConnection.ts +3 -5
- package/front_end/third_party/acorn/acorn.ts +1 -1
- package/front_end/third_party/chromium/client-variations/client-variations.ts +1 -1
- package/front_end/third_party/diff/DiffWrapper.ts +2 -0
- package/front_end/third_party/i18n/i18n-impl.ts +5 -1
- package/front_end/third_party/i18n/i18n.ts +1 -1
- package/front_end/third_party/i18n/locales.ts +1 -1
- package/front_end/third_party/lit-html/directives.ts +1 -0
- package/front_end/third_party/lit-html/lit-html-tsconfig.json +1 -0
- package/front_end/third_party/marked/marked.ts +1 -1
- package/front_end/third_party/puppeteer/package/README.md +136 -214
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts +6 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js +149 -85
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js +34 -10
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/AriaQueryHandler.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts +17 -36
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +217 -160
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts +5 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +18 -13
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js +30 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +21 -20
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js +125 -82
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +1 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +27 -9
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts +6 -30
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js +167 -131
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts +36 -67
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +359 -215
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts +8 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js +9 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts +21 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js +26 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts +2 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js +32 -15
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Dialog.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.d.ts +355 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.js +847 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts +4 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js +25 -8
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EmulationManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +28 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +27 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts +20 -19
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js +146 -126
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts +4 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js +25 -10
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FileChooser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +53 -92
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +337 -320
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts +16 -28
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js +200 -147
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts +1 -18
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js +86 -60
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts +18 -22
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js +166 -117
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts +46 -395
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +80 -842
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts +4 -32
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js +136 -108
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkConditions.d.ts +25 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkConditions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkConditions.js +23 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkConditions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.d.ts +16 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.js +39 -32
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts +2 -42
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js +315 -316
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts +5 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/PDFOptions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts +246 -287
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js +841 -700
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts +37 -74
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.js +37 -89
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts +38 -13
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.js +79 -29
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/QueryHandler.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts +1 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.js +31 -12
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/SecurityDetails.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts +6 -9
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.js +80 -40
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TaskQueue.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TaskQueue.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TaskQueue.js +24 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TaskQueue.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.js +28 -10
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/TimeoutSettings.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts +4 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js +50 -23
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Tracing.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/USKeyboardLayout.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts +9 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.js +41 -31
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts +4 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js +6 -8
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/fetch.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/fetch.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/fetch.js +6 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/fetch.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/types.d.ts +48 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/types.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/{EvalTypes.js → types.js} +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/types.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.d.ts +129 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/{helper.js → util.js} +168 -87
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/compat.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/constants.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/{esm/puppeteer/initialize-node.d.ts → cjs/puppeteer/initializePuppeteer.d.ts} +5 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initializePuppeteer.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/{initialize-node.js → initializePuppeteer.js} +18 -14
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initializePuppeteer.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +4 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js +226 -158
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts +9 -11
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js +116 -72
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts +27 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +176 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.d.ts +49 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.js +361 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts +6 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js +44 -12
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts +4 -20
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.js +60 -35
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ProductLauncher.d.ts +31 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ProductLauncher.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ProductLauncher.js +166 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ProductLauncher.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts +42 -41
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.js +69 -47
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js +55 -32
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/util.d.ts +10 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/util.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/util.js +40 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/util.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer-core.d.ts +23 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer-core.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer-core.js +41 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer-core.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer.d.ts +26 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer.js +44 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/puppeteer.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +6 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +6 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/tsconfig.cjs.tsbuildinfo +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/tsconfig.tsbuildinfo +1 -0
- package/front_end/third_party/puppeteer/package/lib/{esm/puppeteer/api-docs-entry.js → cjs/puppeteer/types.d.ts} +46 -63
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/types.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/{api-docs-entry.js → types.js} +50 -51
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/types.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.js +11 -12
- package/front_end/third_party/puppeteer/package/lib/cjs/vendor/tsconfig.cjs.tsbuildinfo +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.d.ts +6 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js +149 -85
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js +34 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/AriaQueryHandler.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts +17 -36
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +217 -160
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts +5 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +16 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js +30 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts +21 -20
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js +125 -82
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +1 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +27 -9
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts +6 -30
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js +167 -131
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts +36 -67
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +335 -214
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.d.ts +8 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.js +9 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Debug.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts +21 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js +25 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.d.ts +2 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.js +32 -15
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Dialog.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.d.ts +355 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.js +820 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.d.ts +4 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.js +25 -8
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EmulationManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +28 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +26 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts +20 -19
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.js +145 -125
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.d.ts +4 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.js +25 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FileChooser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +53 -92
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +337 -320
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts +16 -28
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js +199 -146
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts +1 -18
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js +86 -60
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts +18 -22
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.js +167 -118
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts +46 -395
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +80 -817
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts +4 -32
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js +135 -107
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/LifecycleWatcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkConditions.d.ts +25 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkConditions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkConditions.js +23 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkConditions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.d.ts +16 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.js +39 -32
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts +2 -42
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js +312 -313
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.d.ts +5 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/PDFOptions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts +246 -287
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js +819 -701
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.d.ts +37 -74
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js +39 -91
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.d.ts +38 -13
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js +79 -29
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/QueryHandler.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.d.ts +1 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.js +31 -12
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/SecurityDetails.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.d.ts +6 -9
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.js +80 -40
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Target.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TaskQueue.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TaskQueue.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TaskQueue.js +24 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TaskQueue.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.d.ts +1 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js +28 -10
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/TimeoutSettings.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.d.ts +4 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js +50 -23
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Tracing.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/USKeyboardLayout.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts +9 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js +41 -31
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts +4 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js +5 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js +6 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/types.d.ts +48 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/types.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/{EvalTypes.js → types.js} +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/types.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.d.ts +129 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/{helper.js → util.js} +161 -100
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/compat.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/constants.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +4 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/initialize-node.d.ts → esm/puppeteer/initializePuppeteer.d.ts} +5 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initializePuppeteer.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/{initialize-node.js → initializePuppeteer.js} +16 -12
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initializePuppeteer.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts +4 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js +226 -158
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts +9 -11
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js +113 -69
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts +27 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +169 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/FirefoxLauncher.d.ts +49 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/FirefoxLauncher.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/{Launcher.js → FirefoxLauncher.js} +51 -345
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/FirefoxLauncher.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts +6 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js +44 -12
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.d.ts +4 -20
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js +60 -35
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ProductLauncher.d.ts +31 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ProductLauncher.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ProductLauncher.js +157 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ProductLauncher.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts +42 -41
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js +70 -45
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts +6 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js +53 -30
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/util.d.ts +10 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/util.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/util.js +13 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/util.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/puppeteer-core.d.ts +23 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/puppeteer-core.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/{node-puppeteer-core.d.ts → puppeteer-core.js} +8 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/puppeteer-core.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/puppeteer.d.ts +26 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/puppeteer.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/{cjs/puppeteer/node-puppeteer-core.d.ts → esm/puppeteer/puppeteer.js} +11 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/puppeteer.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +6 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +6 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/tsconfig.esm.tsbuildinfo +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/tsconfig.tsbuildinfo +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.d.ts +64 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.js +68 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.d.ts +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js +9 -10
- package/front_end/third_party/puppeteer/package/lib/esm/vendor/tsconfig.esm.tsbuildinfo +1 -0
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +846 -1670
- package/front_end/third_party/puppeteer/package/package.json +65 -68
- package/front_end/third_party/puppeteer/package/typescript-if-required.js +17 -8
- package/front_end/third_party/puppeteer/puppeteer.ts +2 -9
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +2 -5
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorController.ts +45 -3
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspectorPane.ts +40 -12
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +5 -5
- package/front_end/ui/legacy/ReportView.ts +8 -0
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +13 -10
- package/front_end/ui/legacy/components/object_ui/objectValue.css +4 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +3 -1
- package/package.json +1 -1
- package/scripts/eslint_rules/lib/custom_element_definitions_location.js +28 -13
- package/scripts/eslint_rules/lib/es_modules_import.js +5 -1
- package/scripts/eslint_rules/lib/inject_checkbox_styles.js +4 -2
- package/scripts/eslint_rules/tests/custom_element_definitions_location_test.js +9 -2
- package/scripts/eslint_rules/tests/es_modules_import_test.js +5 -0
- package/scripts/eslint_rules/tests/inject_checkbox_styles_test.js +45 -5
- package/front_end/third_party/puppeteer/package/cjs-entry-core.js +0 -29
- package/front_end/third_party/puppeteer/package/cjs-entry.js +0 -29
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts +0 -111
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api-docs-entry.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts +0 -61
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EvalTypes.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts +0 -82
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js +0 -87
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Events.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts +0 -85
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-web.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-web.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-web.js +0 -27
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-web.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +0 -674
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node-puppeteer-core.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node-puppeteer-core.js +0 -25
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node-puppeteer-core.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node.js +0 -24
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/web.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/web.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/web.js +0 -24
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/web.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/vendor/mitt/src/index.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.d.ts +0 -111
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api-docs-entry.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts +0 -61
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EvalTypes.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.d.ts +0 -82
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.js +0 -84
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Events.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts +0 -85
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js +0 -23
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-web.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js +0 -23
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node-puppeteer-core.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js +0 -22
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts +0 -18
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js +0 -22
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/web.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/vendor/mitt/src/index.js.map +0 -1
@@ -14,38 +14,74 @@
|
|
14
14
|
* See the License for the specific language governing permissions and
|
15
15
|
* limitations under the License.
|
16
16
|
*/
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
18
|
+
if (k2 === undefined) k2 = k;
|
19
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
20
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
21
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
22
|
+
}
|
23
|
+
Object.defineProperty(o, k2, desc);
|
24
|
+
}) : (function(o, m, k, k2) {
|
25
|
+
if (k2 === undefined) k2 = k;
|
26
|
+
o[k2] = m[k];
|
27
|
+
}));
|
28
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
29
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
30
|
+
}) : function(o, v) {
|
31
|
+
o["default"] = v;
|
32
|
+
});
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
34
|
+
if (mod && mod.__esModule) return mod;
|
35
|
+
var result = {};
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
37
|
+
__setModuleDefault(result, mod);
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
41
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
42
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
43
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
44
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
45
|
+
};
|
46
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
47
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
48
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
49
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
50
|
+
};
|
51
|
+
var _Page_instances, _Page_closed, _Page_client, _Page_target, _Page_keyboard, _Page_mouse, _Page_timeoutSettings, _Page_touchscreen, _Page_accessibility, _Page_frameManager, _Page_emulationManager, _Page_tracing, _Page_pageBindings, _Page_coverage, _Page_javascriptEnabled, _Page_viewport, _Page_screenshotTaskQueue, _Page_workers, _Page_fileChooserInterceptors, _Page_disconnectPromise, _Page_userDragInterceptionEnabled, _Page_handlerMap, _Page_initialize, _Page_onFileChooser, _Page_onTargetCrashed, _Page_onLogEntryAdded, _Page_emitMetrics, _Page_buildMetricsObject, _Page_handleException, _Page_onConsoleAPI, _Page_onBindingCalled, _Page_addConsoleMessage, _Page_onDialog, _Page_resetDefaultBackgroundColor, _Page_setTransparentBackgroundColor, _Page_sessionClosePromise, _Page_go, _Page_screenshotTask;
|
17
52
|
Object.defineProperty(exports, "__esModule", { value: true });
|
18
53
|
exports.Page = void 0;
|
19
|
-
const
|
54
|
+
const Accessibility_js_1 = require("./Accessibility.js");
|
55
|
+
const assert_js_1 = require("./assert.js");
|
20
56
|
const Connection_js_1 = require("./Connection.js");
|
57
|
+
const ConsoleMessage_js_1 = require("./ConsoleMessage.js");
|
58
|
+
const Coverage_js_1 = require("./Coverage.js");
|
21
59
|
const Dialog_js_1 = require("./Dialog.js");
|
22
60
|
const EmulationManager_js_1 = require("./EmulationManager.js");
|
61
|
+
const EventEmitter_js_1 = require("./EventEmitter.js");
|
62
|
+
const FileChooser_js_1 = require("./FileChooser.js");
|
23
63
|
const FrameManager_js_1 = require("./FrameManager.js");
|
24
64
|
const Input_js_1 = require("./Input.js");
|
25
|
-
const Tracing_js_1 = require("./Tracing.js");
|
26
|
-
const assert_js_1 = require("./assert.js");
|
27
|
-
const helper_js_1 = require("./helper.js");
|
28
|
-
const Coverage_js_1 = require("./Coverage.js");
|
29
|
-
const WebWorker_js_1 = require("./WebWorker.js");
|
30
|
-
const JSHandle_js_1 = require("./JSHandle.js");
|
31
65
|
const NetworkManager_js_1 = require("./NetworkManager.js");
|
32
|
-
const Accessibility_js_1 = require("./Accessibility.js");
|
33
|
-
const TimeoutSettings_js_1 = require("./TimeoutSettings.js");
|
34
|
-
const FileChooser_js_1 = require("./FileChooser.js");
|
35
|
-
const ConsoleMessage_js_1 = require("./ConsoleMessage.js");
|
36
66
|
const PDFOptions_js_1 = require("./PDFOptions.js");
|
37
|
-
const
|
67
|
+
const TimeoutSettings_js_1 = require("./TimeoutSettings.js");
|
68
|
+
const Tracing_js_1 = require("./Tracing.js");
|
69
|
+
const util_js_1 = require("./util.js");
|
70
|
+
const WebWorker_js_1 = require("./WebWorker.js");
|
38
71
|
/**
|
39
72
|
* Page provides methods to interact with a single tab or
|
40
|
-
* {@link https://developer.chrome.com/extensions/background_pages | extension background page}
|
73
|
+
* {@link https://developer.chrome.com/extensions/background_pages | extension background page}
|
74
|
+
* in Chromium.
|
41
75
|
*
|
42
|
-
*
|
76
|
+
* :::note
|
43
77
|
*
|
44
78
|
* One Browser instance might have multiple Page instances.
|
45
79
|
*
|
80
|
+
* :::
|
81
|
+
*
|
46
82
|
* @example
|
47
|
-
* This example creates a page, navigates it to a URL, and then
|
48
|
-
* ```
|
83
|
+
* This example creates a page, navigates it to a URL, and then saves a screenshot:
|
84
|
+
* ```ts
|
49
85
|
* const puppeteer = require('puppeteer');
|
50
86
|
*
|
51
87
|
* (async () => {
|
@@ -62,13 +98,13 @@ const environment_js_1 = require("../environment.js");
|
|
62
98
|
*
|
63
99
|
* @example
|
64
100
|
* This example logs a message for a single page `load` event:
|
65
|
-
* ```
|
101
|
+
* ```ts
|
66
102
|
* page.once('load', () => console.log('Page loaded!'));
|
67
103
|
* ```
|
68
104
|
*
|
69
|
-
* To unsubscribe from events use the
|
105
|
+
* To unsubscribe from events use the {@link Page.off} method:
|
70
106
|
*
|
71
|
-
* ```
|
107
|
+
* ```ts
|
72
108
|
* function logRequest(interceptedRequest) {
|
73
109
|
* console.log('A request was made:', interceptedRequest.url());
|
74
110
|
* }
|
@@ -76,6 +112,7 @@ const environment_js_1 = require("../environment.js");
|
|
76
112
|
* // Sometime later...
|
77
113
|
* page.off('request', logRequest);
|
78
114
|
* ```
|
115
|
+
*
|
79
116
|
* @public
|
80
117
|
*/
|
81
118
|
class Page extends EventEmitter_js_1.EventEmitter {
|
@@ -84,141 +121,179 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
84
121
|
*/
|
85
122
|
constructor(client, target, ignoreHTTPSErrors, screenshotTaskQueue) {
|
86
123
|
super();
|
87
|
-
this
|
88
|
-
this
|
89
|
-
this
|
90
|
-
this
|
91
|
-
this
|
92
|
-
|
93
|
-
|
94
|
-
this
|
95
|
-
this
|
96
|
-
this
|
97
|
-
this
|
98
|
-
this
|
99
|
-
this
|
100
|
-
|
101
|
-
|
102
|
-
this
|
103
|
-
|
104
|
-
this
|
105
|
-
this
|
106
|
-
this
|
107
|
-
this
|
108
|
-
this
|
124
|
+
_Page_instances.add(this);
|
125
|
+
_Page_closed.set(this, false);
|
126
|
+
_Page_client.set(this, void 0);
|
127
|
+
_Page_target.set(this, void 0);
|
128
|
+
_Page_keyboard.set(this, void 0);
|
129
|
+
_Page_mouse.set(this, void 0);
|
130
|
+
_Page_timeoutSettings.set(this, new TimeoutSettings_js_1.TimeoutSettings());
|
131
|
+
_Page_touchscreen.set(this, void 0);
|
132
|
+
_Page_accessibility.set(this, void 0);
|
133
|
+
_Page_frameManager.set(this, void 0);
|
134
|
+
_Page_emulationManager.set(this, void 0);
|
135
|
+
_Page_tracing.set(this, void 0);
|
136
|
+
_Page_pageBindings.set(this, new Map());
|
137
|
+
_Page_coverage.set(this, void 0);
|
138
|
+
_Page_javascriptEnabled.set(this, true);
|
139
|
+
_Page_viewport.set(this, void 0);
|
140
|
+
_Page_screenshotTaskQueue.set(this, void 0);
|
141
|
+
_Page_workers.set(this, new Map());
|
142
|
+
_Page_fileChooserInterceptors.set(this, new Set());
|
143
|
+
_Page_disconnectPromise.set(this, void 0);
|
144
|
+
_Page_userDragInterceptionEnabled.set(this, false);
|
145
|
+
_Page_handlerMap.set(this, new WeakMap());
|
146
|
+
__classPrivateFieldSet(this, _Page_client, client, "f");
|
147
|
+
__classPrivateFieldSet(this, _Page_target, target, "f");
|
148
|
+
__classPrivateFieldSet(this, _Page_keyboard, new Input_js_1.Keyboard(client), "f");
|
149
|
+
__classPrivateFieldSet(this, _Page_mouse, new Input_js_1.Mouse(client, __classPrivateFieldGet(this, _Page_keyboard, "f")), "f");
|
150
|
+
__classPrivateFieldSet(this, _Page_touchscreen, new Input_js_1.Touchscreen(client, __classPrivateFieldGet(this, _Page_keyboard, "f")), "f");
|
151
|
+
__classPrivateFieldSet(this, _Page_accessibility, new Accessibility_js_1.Accessibility(client), "f");
|
152
|
+
__classPrivateFieldSet(this, _Page_frameManager, new FrameManager_js_1.FrameManager(client, this, ignoreHTTPSErrors, __classPrivateFieldGet(this, _Page_timeoutSettings, "f")), "f");
|
153
|
+
__classPrivateFieldSet(this, _Page_emulationManager, new EmulationManager_js_1.EmulationManager(client), "f");
|
154
|
+
__classPrivateFieldSet(this, _Page_tracing, new Tracing_js_1.Tracing(client), "f");
|
155
|
+
__classPrivateFieldSet(this, _Page_coverage, new Coverage_js_1.Coverage(client), "f");
|
156
|
+
__classPrivateFieldSet(this, _Page_screenshotTaskQueue, screenshotTaskQueue, "f");
|
157
|
+
__classPrivateFieldSet(this, _Page_viewport, null, "f");
|
109
158
|
client.on('Target.attachedToTarget', (event) => {
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
159
|
+
switch (event.targetInfo.type) {
|
160
|
+
case 'worker':
|
161
|
+
const connection = Connection_js_1.Connection.fromSession(client);
|
162
|
+
(0, assert_js_1.assert)(connection);
|
163
|
+
const session = connection.session(event.sessionId);
|
164
|
+
(0, assert_js_1.assert)(session);
|
165
|
+
const worker = new WebWorker_js_1.WebWorker(session, event.targetInfo.url, __classPrivateFieldGet(this, _Page_instances, "m", _Page_addConsoleMessage).bind(this), __classPrivateFieldGet(this, _Page_instances, "m", _Page_handleException).bind(this));
|
166
|
+
__classPrivateFieldGet(this, _Page_workers, "f").set(event.sessionId, worker);
|
167
|
+
this.emit("workercreated" /* PageEmittedEvents.WorkerCreated */, worker);
|
168
|
+
break;
|
169
|
+
case 'iframe':
|
170
|
+
break;
|
171
|
+
default:
|
172
|
+
// If we don't detach from service workers, they will never die. We
|
173
|
+
// still want to attach to workers for emitting events. We still
|
174
|
+
// want to attach to iframes so sessions may interact with them. We
|
175
|
+
// detach from all other types out of an abundance of caution. See
|
176
|
+
// https://source.chromium.org/chromium/chromium/src/+/main:content/browser/devtools/devtools_agent_host_impl.cc?ss=chromium&q=f:devtools%20-f:out%20%22::kTypePage%5B%5D%22
|
177
|
+
// for the complete list of available types.
|
178
|
+
client
|
179
|
+
.send('Target.detachFromTarget', {
|
180
|
+
sessionId: event.sessionId,
|
181
|
+
})
|
182
|
+
.catch(util_js_1.debugError);
|
130
183
|
}
|
131
184
|
});
|
132
|
-
client.on('Target.detachedFromTarget',
|
133
|
-
const worker = this.
|
134
|
-
if (!worker)
|
185
|
+
client.on('Target.detachedFromTarget', event => {
|
186
|
+
const worker = __classPrivateFieldGet(this, _Page_workers, "f").get(event.sessionId);
|
187
|
+
if (!worker) {
|
135
188
|
return;
|
136
|
-
|
137
|
-
this
|
189
|
+
}
|
190
|
+
__classPrivateFieldGet(this, _Page_workers, "f").delete(event.sessionId);
|
191
|
+
this.emit("workerdestroyed" /* PageEmittedEvents.WorkerDestroyed */, worker);
|
192
|
+
});
|
193
|
+
__classPrivateFieldGet(this, _Page_frameManager, "f").on(FrameManager_js_1.FrameManagerEmittedEvents.FrameAttached, event => {
|
194
|
+
return this.emit("frameattached" /* PageEmittedEvents.FrameAttached */, event);
|
195
|
+
});
|
196
|
+
__classPrivateFieldGet(this, _Page_frameManager, "f").on(FrameManager_js_1.FrameManagerEmittedEvents.FrameDetached, event => {
|
197
|
+
return this.emit("framedetached" /* PageEmittedEvents.FrameDetached */, event);
|
198
|
+
});
|
199
|
+
__classPrivateFieldGet(this, _Page_frameManager, "f").on(FrameManager_js_1.FrameManagerEmittedEvents.FrameNavigated, event => {
|
200
|
+
return this.emit("framenavigated" /* PageEmittedEvents.FrameNavigated */, event);
|
201
|
+
});
|
202
|
+
const networkManager = __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager();
|
203
|
+
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.Request, event => {
|
204
|
+
return this.emit("request" /* PageEmittedEvents.Request */, event);
|
205
|
+
});
|
206
|
+
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.RequestServedFromCache, event => {
|
207
|
+
return this.emit("requestservedfromcache" /* PageEmittedEvents.RequestServedFromCache */, event);
|
208
|
+
});
|
209
|
+
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.Response, event => {
|
210
|
+
return this.emit("response" /* PageEmittedEvents.Response */, event);
|
211
|
+
});
|
212
|
+
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.RequestFailed, event => {
|
213
|
+
return this.emit("requestfailed" /* PageEmittedEvents.RequestFailed */, event);
|
214
|
+
});
|
215
|
+
networkManager.on(NetworkManager_js_1.NetworkManagerEmittedEvents.RequestFinished, event => {
|
216
|
+
return this.emit("requestfinished" /* PageEmittedEvents.RequestFinished */, event);
|
217
|
+
});
|
218
|
+
__classPrivateFieldSet(this, _Page_fileChooserInterceptors, new Set(), "f");
|
219
|
+
client.on('Page.domContentEventFired', () => {
|
220
|
+
return this.emit("domcontentloaded" /* PageEmittedEvents.DOMContentLoaded */);
|
221
|
+
});
|
222
|
+
client.on('Page.loadEventFired', () => {
|
223
|
+
return this.emit("load" /* PageEmittedEvents.Load */);
|
138
224
|
});
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
client.on('
|
152
|
-
|
153
|
-
|
154
|
-
client.on('
|
155
|
-
|
156
|
-
|
157
|
-
client.on('Log.entryAdded',
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
this.
|
225
|
+
client.on('Runtime.consoleAPICalled', event => {
|
226
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_onConsoleAPI).call(this, event);
|
227
|
+
});
|
228
|
+
client.on('Runtime.bindingCalled', event => {
|
229
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_onBindingCalled).call(this, event);
|
230
|
+
});
|
231
|
+
client.on('Page.javascriptDialogOpening', event => {
|
232
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_onDialog).call(this, event);
|
233
|
+
});
|
234
|
+
client.on('Runtime.exceptionThrown', exception => {
|
235
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_handleException).call(this, exception.exceptionDetails);
|
236
|
+
});
|
237
|
+
client.on('Inspector.targetCrashed', () => {
|
238
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_onTargetCrashed).call(this);
|
239
|
+
});
|
240
|
+
client.on('Performance.metrics', event => {
|
241
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_emitMetrics).call(this, event);
|
242
|
+
});
|
243
|
+
client.on('Log.entryAdded', event => {
|
244
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_onLogEntryAdded).call(this, event);
|
245
|
+
});
|
246
|
+
client.on('Page.fileChooserOpened', event => {
|
247
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_onFileChooser).call(this, event);
|
248
|
+
});
|
249
|
+
__classPrivateFieldGet(this, _Page_target, "f")._isClosedPromise.then(() => {
|
250
|
+
this.emit("close" /* PageEmittedEvents.Close */);
|
251
|
+
__classPrivateFieldSet(this, _Page_closed, true, "f");
|
162
252
|
});
|
163
253
|
}
|
164
254
|
/**
|
165
255
|
* @internal
|
166
256
|
*/
|
167
|
-
static async
|
257
|
+
static async _create(client, target, ignoreHTTPSErrors, defaultViewport, screenshotTaskQueue) {
|
168
258
|
const page = new Page(client, target, ignoreHTTPSErrors, screenshotTaskQueue);
|
169
|
-
await page.
|
170
|
-
if (defaultViewport)
|
259
|
+
await __classPrivateFieldGet(page, _Page_instances, "m", _Page_initialize).call(page);
|
260
|
+
if (defaultViewport) {
|
171
261
|
await page.setViewport(defaultViewport);
|
262
|
+
}
|
172
263
|
return page;
|
173
264
|
}
|
174
|
-
async _initialize() {
|
175
|
-
await Promise.all([
|
176
|
-
this._frameManager.initialize(),
|
177
|
-
this._client.send('Target.setAutoAttach', {
|
178
|
-
autoAttach: true,
|
179
|
-
waitForDebuggerOnStart: false,
|
180
|
-
flatten: true,
|
181
|
-
}),
|
182
|
-
this._client.send('Performance.enable'),
|
183
|
-
this._client.send('Log.enable'),
|
184
|
-
]);
|
185
|
-
}
|
186
|
-
async _onFileChooser(event) {
|
187
|
-
if (!this._fileChooserInterceptors.size)
|
188
|
-
return;
|
189
|
-
const frame = this._frameManager.frame(event.frameId);
|
190
|
-
const context = await frame.executionContext();
|
191
|
-
const element = await context._adoptBackendNodeId(event.backendNodeId);
|
192
|
-
const interceptors = Array.from(this._fileChooserInterceptors);
|
193
|
-
this._fileChooserInterceptors.clear();
|
194
|
-
const fileChooser = new FileChooser_js_1.FileChooser(element, event);
|
195
|
-
for (const interceptor of interceptors)
|
196
|
-
interceptor.call(null, fileChooser);
|
197
|
-
}
|
198
265
|
/**
|
199
266
|
* @returns `true` if drag events are being intercepted, `false` otherwise.
|
200
267
|
*/
|
201
268
|
isDragInterceptionEnabled() {
|
202
|
-
return this
|
269
|
+
return __classPrivateFieldGet(this, _Page_userDragInterceptionEnabled, "f");
|
203
270
|
}
|
204
271
|
/**
|
205
272
|
* @returns `true` if the page has JavaScript enabled, `false` otherwise.
|
206
273
|
*/
|
207
274
|
isJavaScriptEnabled() {
|
208
|
-
return this
|
275
|
+
return __classPrivateFieldGet(this, _Page_javascriptEnabled, "f");
|
209
276
|
}
|
210
277
|
/**
|
211
278
|
* Listen to page events.
|
279
|
+
*
|
280
|
+
* :::note
|
281
|
+
*
|
282
|
+
* This method exists to define event typings and handle proper wireup of
|
283
|
+
* cooperative request interception. Actual event listening and dispatching is
|
284
|
+
* delegated to {@link EventEmitter}.
|
285
|
+
*
|
286
|
+
* :::
|
212
287
|
*/
|
213
|
-
// Note: this method exists to define event typings and handle
|
214
|
-
// proper wireup of cooperative request interception. Actual event listening and
|
215
|
-
// dispatching is delegated to EventEmitter.
|
216
288
|
on(eventName, handler) {
|
217
289
|
if (eventName === 'request') {
|
218
|
-
const wrap = (
|
219
|
-
|
220
|
-
|
221
|
-
|
290
|
+
const wrap = __classPrivateFieldGet(this, _Page_handlerMap, "f").get(handler) ||
|
291
|
+
((event) => {
|
292
|
+
event.enqueueInterceptAction(() => {
|
293
|
+
return handler(event);
|
294
|
+
});
|
295
|
+
});
|
296
|
+
__classPrivateFieldGet(this, _Page_handlerMap, "f").set(handler, wrap);
|
222
297
|
return super.on(eventName, wrap);
|
223
298
|
}
|
224
299
|
return super.on(eventName, handler);
|
@@ -230,16 +305,30 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
230
305
|
}
|
231
306
|
off(eventName, handler) {
|
232
307
|
if (eventName === 'request') {
|
233
|
-
handler = this.
|
308
|
+
handler = __classPrivateFieldGet(this, _Page_handlerMap, "f").get(handler) || handler;
|
234
309
|
}
|
235
310
|
return super.off(eventName, handler);
|
236
311
|
}
|
237
312
|
/**
|
238
313
|
* This method is typically coupled with an action that triggers file
|
239
|
-
* choosing.
|
314
|
+
* choosing.
|
315
|
+
*
|
316
|
+
* :::caution
|
317
|
+
*
|
318
|
+
* This must be called before the file chooser is launched. It will not return
|
319
|
+
* a currently active file chooser.
|
320
|
+
*
|
321
|
+
* :::
|
322
|
+
*
|
323
|
+
* @remarks
|
324
|
+
* In non-headless Chromium, this method results in the native file picker
|
325
|
+
* dialog `not showing up` for the user.
|
326
|
+
*
|
327
|
+
* @example
|
328
|
+
* The following example clicks a button that issues a file chooser
|
240
329
|
* and then responds with `/tmp/myfile.pdf` as if a user has selected this file.
|
241
330
|
*
|
242
|
-
* ```
|
331
|
+
* ```ts
|
243
332
|
* const [fileChooser] = await Promise.all([
|
244
333
|
* page.waitForFileChooser(),
|
245
334
|
* page.click('#upload-file-button'),
|
@@ -247,28 +336,21 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
247
336
|
* ]);
|
248
337
|
* await fileChooser.accept(['/tmp/myfile.pdf']);
|
249
338
|
* ```
|
250
|
-
*
|
251
|
-
* NOTE: This must be called before the file chooser is launched. It will not
|
252
|
-
* return a currently active file chooser.
|
253
|
-
* @param options - Optional waiting parameters
|
254
|
-
* @returns Resolves after a page requests a file picker.
|
255
|
-
* @remarks
|
256
|
-
* NOTE: In non-headless Chromium, this method results in the native file picker
|
257
|
-
* dialog `not showing up` for the user.
|
258
339
|
*/
|
259
340
|
async waitForFileChooser(options = {}) {
|
260
|
-
if (!this.
|
261
|
-
await this.
|
341
|
+
if (!__classPrivateFieldGet(this, _Page_fileChooserInterceptors, "f").size) {
|
342
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.setInterceptFileChooserDialog', {
|
262
343
|
enabled: true,
|
263
344
|
});
|
264
|
-
|
345
|
+
}
|
346
|
+
const { timeout = __classPrivateFieldGet(this, _Page_timeoutSettings, "f").timeout() } = options;
|
265
347
|
let callback;
|
266
|
-
const promise = new Promise(
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
this.
|
348
|
+
const promise = new Promise(x => {
|
349
|
+
return (callback = x);
|
350
|
+
});
|
351
|
+
__classPrivateFieldGet(this, _Page_fileChooserInterceptors, "f").add(callback);
|
352
|
+
return (0, util_js_1.waitWithTimeout)(promise, 'waiting for file chooser', timeout).catch(error => {
|
353
|
+
__classPrivateFieldGet(this, _Page_fileChooserInterceptors, "f").delete(callback);
|
272
354
|
throw error;
|
273
355
|
});
|
274
356
|
}
|
@@ -278,19 +360,22 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
278
360
|
* NOTE: Consider using {@link BrowserContext.overridePermissions} to grant
|
279
361
|
* permissions for the page to read its geolocation.
|
280
362
|
* @example
|
281
|
-
* ```
|
363
|
+
* ```ts
|
282
364
|
* await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
|
283
365
|
* ```
|
284
366
|
*/
|
285
367
|
async setGeolocation(options) {
|
286
368
|
const { longitude, latitude, accuracy = 0 } = options;
|
287
|
-
if (longitude < -180 || longitude > 180)
|
369
|
+
if (longitude < -180 || longitude > 180) {
|
288
370
|
throw new Error(`Invalid longitude "${longitude}": precondition -180 <= LONGITUDE <= 180 failed.`);
|
289
|
-
|
371
|
+
}
|
372
|
+
if (latitude < -90 || latitude > 90) {
|
290
373
|
throw new Error(`Invalid latitude "${latitude}": precondition -90 <= LATITUDE <= 90 failed.`);
|
291
|
-
|
374
|
+
}
|
375
|
+
if (accuracy < 0) {
|
292
376
|
throw new Error(`Invalid accuracy "${accuracy}": precondition 0 <= ACCURACY failed.`);
|
293
|
-
|
377
|
+
}
|
378
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setGeolocationOverride', {
|
294
379
|
longitude,
|
295
380
|
latitude,
|
296
381
|
accuracy,
|
@@ -300,36 +385,25 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
300
385
|
* @returns A target this page was created from.
|
301
386
|
*/
|
302
387
|
target() {
|
303
|
-
return this
|
388
|
+
return __classPrivateFieldGet(this, _Page_target, "f");
|
304
389
|
}
|
305
390
|
/**
|
306
|
-
* Get the CDP session client the page belongs to.
|
307
391
|
* @internal
|
308
392
|
*/
|
309
|
-
|
310
|
-
return this
|
393
|
+
_client() {
|
394
|
+
return __classPrivateFieldGet(this, _Page_client, "f");
|
311
395
|
}
|
312
396
|
/**
|
313
397
|
* Get the browser the page belongs to.
|
314
398
|
*/
|
315
399
|
browser() {
|
316
|
-
return this.
|
400
|
+
return __classPrivateFieldGet(this, _Page_target, "f").browser();
|
317
401
|
}
|
318
402
|
/**
|
319
403
|
* Get the browser context that the page belongs to.
|
320
404
|
*/
|
321
405
|
browserContext() {
|
322
|
-
return this.
|
323
|
-
}
|
324
|
-
_onTargetCrashed() {
|
325
|
-
this.emit('error', new Error('Page crashed!'));
|
326
|
-
}
|
327
|
-
_onLogEntryAdded(event) {
|
328
|
-
const { level, text, args, source, url, lineNumber } = event.entry;
|
329
|
-
if (args)
|
330
|
-
args.map((arg) => helper_js_1.helper.releaseObject(this._client, arg));
|
331
|
-
if (source !== 'worker')
|
332
|
-
this.emit("console" /* Console */, new ConsoleMessage_js_1.ConsoleMessage(level, text, [], [{ url, lineNumber }]));
|
406
|
+
return __classPrivateFieldGet(this, _Page_target, "f").browserContext();
|
333
407
|
}
|
334
408
|
/**
|
335
409
|
* @returns The page's main frame.
|
@@ -337,28 +411,28 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
337
411
|
* Page is guaranteed to have a main frame which persists during navigations.
|
338
412
|
*/
|
339
413
|
mainFrame() {
|
340
|
-
return this.
|
414
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").mainFrame();
|
341
415
|
}
|
342
416
|
get keyboard() {
|
343
|
-
return this
|
417
|
+
return __classPrivateFieldGet(this, _Page_keyboard, "f");
|
344
418
|
}
|
345
419
|
get touchscreen() {
|
346
|
-
return this
|
420
|
+
return __classPrivateFieldGet(this, _Page_touchscreen, "f");
|
347
421
|
}
|
348
422
|
get coverage() {
|
349
|
-
return this
|
423
|
+
return __classPrivateFieldGet(this, _Page_coverage, "f");
|
350
424
|
}
|
351
425
|
get tracing() {
|
352
|
-
return this
|
426
|
+
return __classPrivateFieldGet(this, _Page_tracing, "f");
|
353
427
|
}
|
354
428
|
get accessibility() {
|
355
|
-
return this
|
429
|
+
return __classPrivateFieldGet(this, _Page_accessibility, "f");
|
356
430
|
}
|
357
431
|
/**
|
358
432
|
* @returns An array of all frames attached to the page.
|
359
433
|
*/
|
360
434
|
frames() {
|
361
|
-
return this.
|
435
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").frames();
|
362
436
|
}
|
363
437
|
/**
|
364
438
|
* @returns all of the dedicated
|
@@ -369,7 +443,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
369
443
|
* NOTE: This does not contain ServiceWorkers
|
370
444
|
*/
|
371
445
|
workers() {
|
372
|
-
return Array.from(this.
|
446
|
+
return Array.from(__classPrivateFieldGet(this, _Page_workers, "f").values());
|
373
447
|
}
|
374
448
|
/**
|
375
449
|
* @param value - Whether to enable request interception.
|
@@ -384,7 +458,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
384
458
|
*
|
385
459
|
* @example
|
386
460
|
* An example of a naïve request interceptor that aborts all image requests:
|
387
|
-
* ```
|
461
|
+
* ```ts
|
388
462
|
* const puppeteer = require('puppeteer');
|
389
463
|
* (async () => {
|
390
464
|
* const browser = await puppeteer.launch();
|
@@ -404,7 +478,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
404
478
|
* NOTE: Enabling request interception disables page caching.
|
405
479
|
*/
|
406
480
|
async setRequestInterception(value) {
|
407
|
-
return this.
|
481
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager().setRequestInterception(value);
|
408
482
|
}
|
409
483
|
/**
|
410
484
|
* @param enabled - Whether to enable drag interception.
|
@@ -415,8 +489,8 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
415
489
|
* on the page, which can then be used to simulate drag-and-drop.
|
416
490
|
*/
|
417
491
|
async setDragInterception(enabled) {
|
418
|
-
this
|
419
|
-
return this.
|
492
|
+
__classPrivateFieldSet(this, _Page_userDragInterceptionEnabled, enabled, "f");
|
493
|
+
return __classPrivateFieldGet(this, _Page_client, "f").send('Input.setInterceptDrags', { enabled });
|
420
494
|
}
|
421
495
|
/**
|
422
496
|
* @param enabled - When `true`, enables offline mode for the page.
|
@@ -426,12 +500,12 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
426
500
|
* (#pageemulatenetworkconditionsnetworkconditions)
|
427
501
|
*/
|
428
502
|
setOfflineMode(enabled) {
|
429
|
-
return this.
|
503
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager().setOfflineMode(enabled);
|
430
504
|
}
|
431
505
|
/**
|
432
506
|
* @param networkConditions - Passing `null` disables network condition emulation.
|
433
507
|
* @example
|
434
|
-
* ```
|
508
|
+
* ```ts
|
435
509
|
* const puppeteer = require('puppeteer');
|
436
510
|
* const slow3G = puppeteer.networkConditions['Slow 3G'];
|
437
511
|
*
|
@@ -450,7 +524,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
450
524
|
* [page.setOfflineMode(enabled)](#pagesetofflinemodeenabled).
|
451
525
|
*/
|
452
526
|
emulateNetworkConditions(networkConditions) {
|
453
|
-
return this
|
527
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f")
|
454
528
|
.networkManager()
|
455
529
|
.emulateNetworkConditions(networkConditions);
|
456
530
|
}
|
@@ -472,21 +546,18 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
472
546
|
* @param timeout - Maximum navigation time in milliseconds.
|
473
547
|
*/
|
474
548
|
setDefaultNavigationTimeout(timeout) {
|
475
|
-
this.
|
549
|
+
__classPrivateFieldGet(this, _Page_timeoutSettings, "f").setDefaultNavigationTimeout(timeout);
|
476
550
|
}
|
477
551
|
/**
|
478
552
|
* @param timeout - Maximum time in milliseconds.
|
479
553
|
*/
|
480
554
|
setDefaultTimeout(timeout) {
|
481
|
-
this.
|
555
|
+
__classPrivateFieldGet(this, _Page_timeoutSettings, "f").setDefaultTimeout(timeout);
|
482
556
|
}
|
483
557
|
/**
|
484
558
|
* Runs `document.querySelector` within the page. If no element matches the
|
485
559
|
* selector, the return value resolves to `null`.
|
486
560
|
*
|
487
|
-
* @remarks
|
488
|
-
* Shortcut for {@link Frame.$ | Page.mainFrame().$(selector) }.
|
489
|
-
*
|
490
561
|
* @param selector - A `selector` to query page for
|
491
562
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
492
563
|
* to query page for.
|
@@ -494,6 +565,16 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
494
565
|
async $(selector) {
|
495
566
|
return this.mainFrame().$(selector);
|
496
567
|
}
|
568
|
+
/**
|
569
|
+
* The method runs `document.querySelectorAll` within the page. If no elements
|
570
|
+
* match the selector, the return value resolves to `[]`.
|
571
|
+
* @remarks
|
572
|
+
* Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
|
573
|
+
* @param selector - A `selector` to query page for
|
574
|
+
*/
|
575
|
+
async $$(selector) {
|
576
|
+
return this.mainFrame().$$(selector);
|
577
|
+
}
|
497
578
|
/**
|
498
579
|
* @remarks
|
499
580
|
*
|
@@ -508,13 +589,13 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
508
589
|
* recommended as they are easier to debug and use with TypeScript):
|
509
590
|
*
|
510
591
|
* @example
|
511
|
-
* ```
|
592
|
+
* ```ts
|
512
593
|
* const aHandle = await page.evaluateHandle('document')
|
513
594
|
* ```
|
514
595
|
*
|
515
596
|
* @example
|
516
597
|
* {@link JSHandle} instances can be passed as arguments to the `pageFunction`:
|
517
|
-
* ```
|
598
|
+
* ```ts
|
518
599
|
* const aHandle = await page.evaluateHandle(() => document.body);
|
519
600
|
* const resultHandle = await page.evaluateHandle(body => body.innerHTML, aHandle);
|
520
601
|
* console.log(await resultHandle.jsonValue());
|
@@ -526,7 +607,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
526
607
|
* you instead get an {@link ElementHandle} back:
|
527
608
|
*
|
528
609
|
* @example
|
529
|
-
* ```
|
610
|
+
* ```ts
|
530
611
|
* const button = await page.evaluateHandle(() => document.querySelector('button'));
|
531
612
|
* // can call `click` because `button` is an `ElementHandle`
|
532
613
|
* await button.click();
|
@@ -536,7 +617,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
536
617
|
* a `JSHandle`, but if you know it's going to return an
|
537
618
|
* `ElementHandle`, pass it as the generic argument:
|
538
619
|
*
|
539
|
-
* ```
|
620
|
+
* ```ts
|
540
621
|
* const button = await page.evaluateHandle<ElementHandle>(...);
|
541
622
|
* ```
|
542
623
|
*
|
@@ -558,7 +639,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
558
639
|
*
|
559
640
|
* @example
|
560
641
|
*
|
561
|
-
* ```
|
642
|
+
* ```ts
|
562
643
|
* // Create a Map object
|
563
644
|
* await page.evaluate(() => window.map = new Map());
|
564
645
|
* // Get a handle to the Map object prototype
|
@@ -591,7 +672,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
591
672
|
*
|
592
673
|
* @example
|
593
674
|
*
|
594
|
-
* ```
|
675
|
+
* ```ts
|
595
676
|
* const searchValue = await page.$eval('#search', el => el.value);
|
596
677
|
* const preloadHref = await page.$eval('link[rel=preload]', el => el.href);
|
597
678
|
* const html = await page.$eval('.main-container', el => el.outerHTML);
|
@@ -604,7 +685,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
604
685
|
*
|
605
686
|
* @example
|
606
687
|
*
|
607
|
-
* ```
|
688
|
+
* ```ts
|
608
689
|
* // if you don't provide HTMLInputElement here, TS will error
|
609
690
|
* // as `value` is not on `Element`
|
610
691
|
* const searchValue = await page.$eval('#search', (el: HTMLInputElement) => el.value);
|
@@ -616,7 +697,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
616
697
|
*
|
617
698
|
* @example
|
618
699
|
*
|
619
|
-
* ```
|
700
|
+
* ```ts
|
620
701
|
* // The compiler can infer the return type in this case, but if it can't
|
621
702
|
* // or if you want to be more explicit, provide it as the generic type.
|
622
703
|
* const searchValue = await page.$eval<string>(
|
@@ -650,7 +731,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
650
731
|
*
|
651
732
|
* @example
|
652
733
|
*
|
653
|
-
* ```
|
734
|
+
* ```ts
|
654
735
|
* // get the amount of divs on the page
|
655
736
|
* const divCount = await page.$$eval('div', divs => divs.length);
|
656
737
|
*
|
@@ -667,7 +748,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
667
748
|
*
|
668
749
|
* @example
|
669
750
|
*
|
670
|
-
* ```
|
751
|
+
* ```ts
|
671
752
|
* // if you don't provide HTMLInputElement here, TS will error
|
672
753
|
* // as `value` is not on `Element`
|
673
754
|
* await page.$$eval('input', (elements: HTMLInputElement[]) => {
|
@@ -681,7 +762,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
681
762
|
*
|
682
763
|
* @example
|
683
764
|
*
|
684
|
-
* ```
|
765
|
+
* ```ts
|
685
766
|
* // The compiler can infer the return type in this case, but if it can't
|
686
767
|
* // or if you want to be more explicit, provide it as the generic type.
|
687
768
|
* const allInputValues = await page.$$eval<string[]>(
|
@@ -704,16 +785,6 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
704
785
|
async $$eval(selector, pageFunction, ...args) {
|
705
786
|
return this.mainFrame().$$eval(selector, pageFunction, ...args);
|
706
787
|
}
|
707
|
-
/**
|
708
|
-
* The method runs `document.querySelectorAll` within the page. If no elements
|
709
|
-
* match the selector, the return value resolves to `[]`.
|
710
|
-
* @remarks
|
711
|
-
* Shortcut for {@link Frame.$$ | Page.mainFrame().$$(selector) }.
|
712
|
-
* @param selector - A `selector` to query page for
|
713
|
-
*/
|
714
|
-
async $$(selector) {
|
715
|
-
return this.mainFrame().$$(selector);
|
716
|
-
}
|
717
788
|
/**
|
718
789
|
* The method evaluates the XPath expression relative to the page document as
|
719
790
|
* its context node. If there are no such elements, the method resolves to an
|
@@ -730,13 +801,14 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
730
801
|
* URL. If URLs are specified, only cookies for those URLs are returned.
|
731
802
|
*/
|
732
803
|
async cookies(...urls) {
|
733
|
-
const originalCookies = (await this.
|
804
|
+
const originalCookies = (await __classPrivateFieldGet(this, _Page_client, "f").send('Network.getCookies', {
|
734
805
|
urls: urls.length ? urls : [this.url()],
|
735
806
|
})).cookies;
|
736
807
|
const unsupportedCookieAttributes = ['priority'];
|
737
808
|
const filterUnsupportedAttributes = (cookie) => {
|
738
|
-
for (const attr of unsupportedCookieAttributes)
|
809
|
+
for (const attr of unsupportedCookieAttributes) {
|
739
810
|
delete cookie[attr];
|
811
|
+
}
|
740
812
|
return cookie;
|
741
813
|
};
|
742
814
|
return originalCookies.map(filterUnsupportedAttributes);
|
@@ -745,31 +817,34 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
745
817
|
const pageURL = this.url();
|
746
818
|
for (const cookie of cookies) {
|
747
819
|
const item = Object.assign({}, cookie);
|
748
|
-
if (!cookie.url && pageURL.startsWith('http'))
|
820
|
+
if (!cookie.url && pageURL.startsWith('http')) {
|
749
821
|
item.url = pageURL;
|
750
|
-
|
822
|
+
}
|
823
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Network.deleteCookies', item);
|
751
824
|
}
|
752
825
|
}
|
753
826
|
/**
|
754
827
|
* @example
|
755
|
-
* ```
|
828
|
+
* ```ts
|
756
829
|
* await page.setCookie(cookieObject1, cookieObject2);
|
757
830
|
* ```
|
758
831
|
*/
|
759
832
|
async setCookie(...cookies) {
|
760
833
|
const pageURL = this.url();
|
761
834
|
const startsWithHTTP = pageURL.startsWith('http');
|
762
|
-
const items = cookies.map(
|
835
|
+
const items = cookies.map(cookie => {
|
763
836
|
const item = Object.assign({}, cookie);
|
764
|
-
if (!item.url && startsWithHTTP)
|
837
|
+
if (!item.url && startsWithHTTP) {
|
765
838
|
item.url = pageURL;
|
839
|
+
}
|
766
840
|
(0, assert_js_1.assert)(item.url !== 'about:blank', `Blank page can not have cookie "${item.name}"`);
|
767
841
|
(0, assert_js_1.assert)(!String.prototype.startsWith.call(item.url || '', 'data:'), `Data URL page can not have cookie "${item.name}"`);
|
768
842
|
return item;
|
769
843
|
});
|
770
844
|
await this.deleteCookie(...items);
|
771
|
-
if (items.length)
|
772
|
-
await this.
|
845
|
+
if (items.length) {
|
846
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Network.setCookies', { cookies: items });
|
847
|
+
}
|
773
848
|
}
|
774
849
|
/**
|
775
850
|
* Adds a `<script>` tag into the page with the desired URL or content.
|
@@ -799,11 +874,11 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
799
874
|
*
|
800
875
|
* NOTE: Functions installed via `page.exposeFunction` survive navigations.
|
801
876
|
* @param name - Name of the function on the window object
|
802
|
-
* @param
|
877
|
+
* @param pptrFunction - Callback function which will be called in
|
803
878
|
* Puppeteer's context.
|
804
879
|
* @example
|
805
880
|
* An example of adding an `md5` function into the page:
|
806
|
-
* ```
|
881
|
+
* ```ts
|
807
882
|
* const puppeteer = require('puppeteer');
|
808
883
|
* const crypto = require('crypto');
|
809
884
|
*
|
@@ -824,7 +899,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
824
899
|
* })();
|
825
900
|
* ```
|
826
901
|
* An example of adding a `window.readfile` function into the page:
|
827
|
-
* ```
|
902
|
+
* ```ts
|
828
903
|
* const puppeteer = require('puppeteer');
|
829
904
|
* const fs = require('fs');
|
830
905
|
*
|
@@ -849,33 +924,35 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
849
924
|
* })();
|
850
925
|
* ```
|
851
926
|
*/
|
852
|
-
async exposeFunction(name,
|
853
|
-
if (this.
|
927
|
+
async exposeFunction(name, pptrFunction) {
|
928
|
+
if (__classPrivateFieldGet(this, _Page_pageBindings, "f").has(name)) {
|
854
929
|
throw new Error(`Failed to add page binding with name ${name}: window['${name}'] already exists!`);
|
855
|
-
let exposedFunction;
|
856
|
-
if (typeof puppeteerFunction === 'function') {
|
857
|
-
exposedFunction = puppeteerFunction;
|
858
930
|
}
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
931
|
+
let exposedFunction;
|
932
|
+
switch (typeof pptrFunction) {
|
933
|
+
case 'function':
|
934
|
+
exposedFunction = pptrFunction;
|
935
|
+
break;
|
936
|
+
default:
|
937
|
+
exposedFunction = pptrFunction.default;
|
938
|
+
break;
|
864
939
|
}
|
865
|
-
this.
|
866
|
-
const expression =
|
867
|
-
await this.
|
868
|
-
await this.
|
940
|
+
__classPrivateFieldGet(this, _Page_pageBindings, "f").set(name, exposedFunction);
|
941
|
+
const expression = (0, util_js_1.pageBindingInitString)('exposedFun', name);
|
942
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Runtime.addBinding', { name: name });
|
943
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.addScriptToEvaluateOnNewDocument', {
|
869
944
|
source: expression,
|
870
945
|
});
|
871
|
-
await Promise.all(this.frames().map(
|
946
|
+
await Promise.all(this.frames().map(frame => {
|
947
|
+
return frame.evaluate(expression).catch(util_js_1.debugError);
|
948
|
+
}));
|
872
949
|
}
|
873
950
|
/**
|
874
951
|
* Provide credentials for `HTTP authentication`.
|
875
952
|
* @remarks To disable authentication, pass `null`.
|
876
953
|
*/
|
877
954
|
async authenticate(credentials) {
|
878
|
-
return this.
|
955
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager().authenticate(credentials);
|
879
956
|
}
|
880
957
|
/**
|
881
958
|
* The extra HTTP headers will be sent with every request the page initiates.
|
@@ -888,7 +965,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
888
965
|
* @returns
|
889
966
|
*/
|
890
967
|
async setExtraHTTPHeaders(headers) {
|
891
|
-
return this.
|
968
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager().setExtraHTTPHeaders(headers);
|
892
969
|
}
|
893
970
|
/**
|
894
971
|
* @param userAgent - Specific user agent to use in this page
|
@@ -897,7 +974,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
897
974
|
* @returns Promise which resolves when the user agent is set.
|
898
975
|
*/
|
899
976
|
async setUserAgent(userAgent, userAgentMetadata) {
|
900
|
-
return this
|
977
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f")
|
901
978
|
.networkManager()
|
902
979
|
.setUserAgent(userAgent, userAgentMetadata);
|
903
980
|
}
|
@@ -936,135 +1013,8 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
936
1013
|
* in seconds since an arbitrary point in the past.
|
937
1014
|
*/
|
938
1015
|
async metrics() {
|
939
|
-
const response = await this.
|
940
|
-
return this.
|
941
|
-
}
|
942
|
-
_emitMetrics(event) {
|
943
|
-
this.emit("metrics" /* Metrics */, {
|
944
|
-
title: event.title,
|
945
|
-
metrics: this._buildMetricsObject(event.metrics),
|
946
|
-
});
|
947
|
-
}
|
948
|
-
_buildMetricsObject(metrics) {
|
949
|
-
const result = {};
|
950
|
-
for (const metric of metrics || []) {
|
951
|
-
if (supportedMetrics.has(metric.name))
|
952
|
-
result[metric.name] = metric.value;
|
953
|
-
}
|
954
|
-
return result;
|
955
|
-
}
|
956
|
-
_handleException(exceptionDetails) {
|
957
|
-
const message = helper_js_1.helper.getExceptionMessage(exceptionDetails);
|
958
|
-
const err = new Error(message);
|
959
|
-
err.stack = ''; // Don't report clientside error with a node stack attached
|
960
|
-
this.emit("pageerror" /* PageError */, err);
|
961
|
-
}
|
962
|
-
async _onConsoleAPI(event) {
|
963
|
-
if (event.executionContextId === 0) {
|
964
|
-
// DevTools protocol stores the last 1000 console messages. These
|
965
|
-
// messages are always reported even for removed execution contexts. In
|
966
|
-
// this case, they are marked with executionContextId = 0 and are
|
967
|
-
// reported upon enabling Runtime agent.
|
968
|
-
//
|
969
|
-
// Ignore these messages since:
|
970
|
-
// - there's no execution context we can use to operate with message
|
971
|
-
// arguments
|
972
|
-
// - these messages are reported before Puppeteer clients can subscribe
|
973
|
-
// to the 'console'
|
974
|
-
// page event.
|
975
|
-
//
|
976
|
-
// @see https://github.com/puppeteer/puppeteer/issues/3865
|
977
|
-
return;
|
978
|
-
}
|
979
|
-
const context = this._frameManager.executionContextById(event.executionContextId, this._client);
|
980
|
-
const values = event.args.map((arg) => (0, JSHandle_js_1.createJSHandle)(context, arg));
|
981
|
-
this._addConsoleMessage(event.type, values, event.stackTrace);
|
982
|
-
}
|
983
|
-
async _onBindingCalled(event) {
|
984
|
-
let payload;
|
985
|
-
try {
|
986
|
-
payload = JSON.parse(event.payload);
|
987
|
-
}
|
988
|
-
catch {
|
989
|
-
// The binding was either called by something in the page or it was
|
990
|
-
// called before our wrapper was initialized.
|
991
|
-
return;
|
992
|
-
}
|
993
|
-
const { type, name, seq, args } = payload;
|
994
|
-
if (type !== 'exposedFun' || !this._pageBindings.has(name))
|
995
|
-
return;
|
996
|
-
let expression = null;
|
997
|
-
try {
|
998
|
-
const result = await this._pageBindings.get(name)(...args);
|
999
|
-
expression = helper_js_1.helper.pageBindingDeliverResultString(name, seq, result);
|
1000
|
-
}
|
1001
|
-
catch (error) {
|
1002
|
-
if (error instanceof Error)
|
1003
|
-
expression = helper_js_1.helper.pageBindingDeliverErrorString(name, seq, error.message, error.stack);
|
1004
|
-
else
|
1005
|
-
expression = helper_js_1.helper.pageBindingDeliverErrorValueString(name, seq, error);
|
1006
|
-
}
|
1007
|
-
this._client
|
1008
|
-
.send('Runtime.evaluate', {
|
1009
|
-
expression,
|
1010
|
-
contextId: event.executionContextId,
|
1011
|
-
})
|
1012
|
-
.catch(helper_js_1.debugError);
|
1013
|
-
}
|
1014
|
-
_addConsoleMessage(type, args, stackTrace) {
|
1015
|
-
if (!this.listenerCount("console" /* Console */)) {
|
1016
|
-
args.forEach((arg) => arg.dispose());
|
1017
|
-
return;
|
1018
|
-
}
|
1019
|
-
const textTokens = [];
|
1020
|
-
for (const arg of args) {
|
1021
|
-
const remoteObject = arg._remoteObject;
|
1022
|
-
if (remoteObject.objectId)
|
1023
|
-
textTokens.push(arg.toString());
|
1024
|
-
else
|
1025
|
-
textTokens.push(helper_js_1.helper.valueFromRemoteObject(remoteObject));
|
1026
|
-
}
|
1027
|
-
const stackTraceLocations = [];
|
1028
|
-
if (stackTrace) {
|
1029
|
-
for (const callFrame of stackTrace.callFrames) {
|
1030
|
-
stackTraceLocations.push({
|
1031
|
-
url: callFrame.url,
|
1032
|
-
lineNumber: callFrame.lineNumber,
|
1033
|
-
columnNumber: callFrame.columnNumber,
|
1034
|
-
});
|
1035
|
-
}
|
1036
|
-
}
|
1037
|
-
const message = new ConsoleMessage_js_1.ConsoleMessage(type, textTokens.join(' '), args, stackTraceLocations);
|
1038
|
-
this.emit("console" /* Console */, message);
|
1039
|
-
}
|
1040
|
-
_onDialog(event) {
|
1041
|
-
let dialogType = null;
|
1042
|
-
const validDialogTypes = new Set([
|
1043
|
-
'alert',
|
1044
|
-
'confirm',
|
1045
|
-
'prompt',
|
1046
|
-
'beforeunload',
|
1047
|
-
]);
|
1048
|
-
if (validDialogTypes.has(event.type)) {
|
1049
|
-
dialogType = event.type;
|
1050
|
-
}
|
1051
|
-
(0, assert_js_1.assert)(dialogType, 'Unknown javascript dialog type: ' + event.type);
|
1052
|
-
const dialog = new Dialog_js_1.Dialog(this._client, dialogType, event.message, event.defaultPrompt);
|
1053
|
-
this.emit("dialog" /* Dialog */, dialog);
|
1054
|
-
}
|
1055
|
-
/**
|
1056
|
-
* Resets default white background
|
1057
|
-
*/
|
1058
|
-
async _resetDefaultBackgroundColor() {
|
1059
|
-
await this._client.send('Emulation.setDefaultBackgroundColorOverride');
|
1060
|
-
}
|
1061
|
-
/**
|
1062
|
-
* Hides default white background
|
1063
|
-
*/
|
1064
|
-
async _setTransparentBackgroundColor() {
|
1065
|
-
await this._client.send('Emulation.setDefaultBackgroundColorOverride', {
|
1066
|
-
color: { r: 0, g: 0, b: 0, a: 0 },
|
1067
|
-
});
|
1016
|
+
const response = await __classPrivateFieldGet(this, _Page_client, "f").send('Performance.getMetrics');
|
1017
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_buildMetricsObject).call(this, response.metrics);
|
1068
1018
|
}
|
1069
1019
|
/**
|
1070
1020
|
*
|
@@ -1076,7 +1026,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1076
1026
|
return this.mainFrame().url();
|
1077
1027
|
}
|
1078
1028
|
async content() {
|
1079
|
-
return await this.
|
1029
|
+
return await __classPrivateFieldGet(this, _Page_frameManager, "f").mainFrame().content();
|
1080
1030
|
}
|
1081
1031
|
/**
|
1082
1032
|
* @param html - HTML markup to assign to the page.
|
@@ -1086,26 +1036,24 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1086
1036
|
*
|
1087
1037
|
* - `timeout` : Maximum time in milliseconds for resources to load, defaults
|
1088
1038
|
* to 30 seconds, pass `0` to disable timeout. The default value can be
|
1089
|
-
* changed by using the
|
1090
|
-
* {@link Page.
|
1091
|
-
*
|
1092
|
-
*
|
1093
|
-
*
|
1094
|
-
*
|
1095
|
-
*
|
1096
|
-
*
|
1097
|
-
*
|
1098
|
-
* - `load` : consider setting content to be finished when the `load` event is
|
1099
|
-
* fired.<br/>
|
1039
|
+
* changed by using the {@link Page.setDefaultNavigationTimeout} or
|
1040
|
+
* {@link Page.setDefaultTimeout} methods.
|
1041
|
+
*
|
1042
|
+
* - `waitUntil`: When to consider setting markup succeeded, defaults to
|
1043
|
+
* `load`. Given an array of event strings, setting content is considered
|
1044
|
+
* to be successful after all events have been fired. Events can be
|
1045
|
+
* either:<br/>
|
1046
|
+
* - `load` : consider setting content to be finished when the `load` event
|
1047
|
+
* is fired.<br/>
|
1100
1048
|
* - `domcontentloaded` : consider setting content to be finished when the
|
1101
|
-
*
|
1102
|
-
* - `networkidle0` : consider setting content to be finished when there are
|
1103
|
-
*
|
1104
|
-
* - `networkidle2` : consider setting content to be finished when there are
|
1105
|
-
*
|
1049
|
+
* `DOMContentLoaded` event is fired.<br/>
|
1050
|
+
* - `networkidle0` : consider setting content to be finished when there are
|
1051
|
+
* no more than 0 network connections for at least `500` ms.<br/>
|
1052
|
+
* - `networkidle2` : consider setting content to be finished when there are
|
1053
|
+
* no more than 2 network connections for at least `500` ms.
|
1106
1054
|
*/
|
1107
1055
|
async setContent(html, options = {}) {
|
1108
|
-
await this.
|
1056
|
+
await __classPrivateFieldGet(this, _Page_frameManager, "f").mainFrame().setContent(html, options);
|
1109
1057
|
}
|
1110
1058
|
/**
|
1111
1059
|
* @param url - URL to navigate page to. The URL should include scheme, e.g.
|
@@ -1119,15 +1067,12 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1119
1067
|
*
|
1120
1068
|
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1121
1069
|
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1122
|
-
* using the
|
1123
|
-
* {@link Page.
|
1124
|
-
* page.setDefaultNavigationTimeout(timeout)}
|
1125
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1126
|
-
* methods.
|
1070
|
+
* using the {@link Page.setDefaultNavigationTimeout} or
|
1071
|
+
* {@link Page.setDefaultTimeout} methods.
|
1127
1072
|
*
|
1128
1073
|
* - `waitUntil`:When to consider navigation succeeded, defaults to `load`.
|
1129
|
-
* Given an array of event strings, navigation is considered to be
|
1130
|
-
* after all events have been fired. Events can be either:<br/>
|
1074
|
+
* Given an array of event strings, navigation is considered to be
|
1075
|
+
* successful after all events have been fired. Events can be either:<br/>
|
1131
1076
|
* - `load` : consider navigation to be finished when the load event is
|
1132
1077
|
* fired.<br/>
|
1133
1078
|
* - `domcontentloaded` : consider navigation to be finished when the
|
@@ -1158,13 +1103,13 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1158
1103
|
* to the same URL with a different hash, which would succeed and return null.
|
1159
1104
|
*
|
1160
1105
|
* NOTE: Headless mode doesn't support navigation to a PDF document. See the
|
1161
|
-
* {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295
|
1162
|
-
*
|
1106
|
+
* {@link https://bugs.chromium.org/p/chromium/issues/detail?id=761295 |
|
1107
|
+
* upstream issue}.
|
1163
1108
|
*
|
1164
1109
|
* Shortcut for {@link Frame.goto | page.mainFrame().goto(url, options)}.
|
1165
1110
|
*/
|
1166
1111
|
async goto(url, options = {}) {
|
1167
|
-
return await this.
|
1112
|
+
return await __classPrivateFieldGet(this, _Page_frameManager, "f").mainFrame().goto(url, options);
|
1168
1113
|
}
|
1169
1114
|
/**
|
1170
1115
|
* @param options - Navigation parameters which might have the following
|
@@ -1177,68 +1122,62 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1177
1122
|
*
|
1178
1123
|
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1179
1124
|
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1180
|
-
* using the
|
1181
|
-
* {@link Page.
|
1182
|
-
* page.setDefaultNavigationTimeout(timeout)}
|
1183
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1184
|
-
* methods.
|
1125
|
+
* using the {@link Page.setDefaultNavigationTimeout} or
|
1126
|
+
* {@link Page.setDefaultTimeout} methods.
|
1185
1127
|
*
|
1186
1128
|
* - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
|
1187
1129
|
* Given an array of event strings, navigation is considered to be
|
1188
1130
|
* successful after all events have been fired. Events can be either:<br/>
|
1189
|
-
* - `load` : consider navigation to be finished when the load event is
|
1131
|
+
* - `load` : consider navigation to be finished when the load event is
|
1132
|
+
* fired.<br/>
|
1190
1133
|
* - `domcontentloaded` : consider navigation to be finished when the
|
1191
|
-
*
|
1134
|
+
* DOMContentLoaded event is fired.<br/>
|
1192
1135
|
* - `networkidle0` : consider navigation to be finished when there are no
|
1193
|
-
*
|
1136
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
1194
1137
|
* - `networkidle2` : consider navigation to be finished when there are no
|
1195
|
-
*
|
1138
|
+
* more than 2 network connections for at least `500` ms.
|
1196
1139
|
*/
|
1197
1140
|
async reload(options) {
|
1198
1141
|
const result = await Promise.all([
|
1199
1142
|
this.waitForNavigation(options),
|
1200
|
-
this.
|
1143
|
+
__classPrivateFieldGet(this, _Page_client, "f").send('Page.reload'),
|
1201
1144
|
]);
|
1202
1145
|
return result[0];
|
1203
1146
|
}
|
1204
1147
|
/**
|
1205
|
-
*
|
1206
|
-
*
|
1207
|
-
*
|
1208
|
-
*
|
1148
|
+
* Waits for the page to navigate to a new URL or to reload. It is useful when
|
1149
|
+
* you run code that will indirectly cause the page to navigate.
|
1150
|
+
*
|
1151
|
+
* @example
|
1152
|
+
* ```ts
|
1209
1153
|
* const [response] = await Promise.all([
|
1210
1154
|
* page.waitForNavigation(), // The promise resolves after navigation has finished
|
1211
1155
|
* page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
|
1212
1156
|
* ]);
|
1213
1157
|
* ```
|
1214
1158
|
*
|
1215
|
-
* @param options - Navigation parameters which might have the following properties:
|
1216
|
-
* @returns Promise which resolves to the main resource response. In case of
|
1217
|
-
* multiple redirects, the navigation will resolve with the response of the
|
1218
|
-
* last redirect. In case of navigation to a different anchor or navigation
|
1219
|
-
* due to History API usage, the navigation will resolve with `null`.
|
1220
1159
|
* @remarks
|
1221
|
-
*
|
1160
|
+
* Usage of the
|
1222
1161
|
* {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API}
|
1223
1162
|
* to change the URL is considered a navigation.
|
1224
1163
|
*
|
1225
|
-
*
|
1226
|
-
*
|
1164
|
+
* @param options - Navigation parameters which might have the following
|
1165
|
+
* properties:
|
1166
|
+
* @returns A `Promise` which resolves to the main resource response.
|
1167
|
+
* - In case of multiple redirects, the navigation will resolve with the
|
1168
|
+
* response of the last redirect.
|
1169
|
+
* - In case of navigation to a different anchor or navigation due to History
|
1170
|
+
* API usage, the navigation will resolve with `null`.
|
1227
1171
|
*/
|
1228
1172
|
async waitForNavigation(options = {}) {
|
1229
|
-
return await this.
|
1230
|
-
}
|
1231
|
-
_sessionClosePromise() {
|
1232
|
-
if (!this._disconnectPromise)
|
1233
|
-
this._disconnectPromise = new Promise((fulfill) => this._client.once(Connection_js_1.CDPSessionEmittedEvents.Disconnected, () => fulfill(new Error('Target closed'))));
|
1234
|
-
return this._disconnectPromise;
|
1173
|
+
return await __classPrivateFieldGet(this, _Page_frameManager, "f").mainFrame().waitForNavigation(options);
|
1235
1174
|
}
|
1236
1175
|
/**
|
1237
1176
|
* @param urlOrPredicate - A URL or predicate to wait for
|
1238
1177
|
* @param options - Optional waiting parameters
|
1239
1178
|
* @returns Promise which resolves to the matched response
|
1240
1179
|
* @example
|
1241
|
-
* ```
|
1180
|
+
* ```ts
|
1242
1181
|
* const firstResponse = await page.waitForResponse(
|
1243
1182
|
* 'https://example.com/resource'
|
1244
1183
|
* );
|
@@ -1259,21 +1198,23 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1259
1198
|
* {@link Page.setDefaultTimeout} method.
|
1260
1199
|
*/
|
1261
1200
|
async waitForRequest(urlOrPredicate, options = {}) {
|
1262
|
-
const { timeout = this.
|
1263
|
-
return
|
1264
|
-
if (
|
1201
|
+
const { timeout = __classPrivateFieldGet(this, _Page_timeoutSettings, "f").timeout() } = options;
|
1202
|
+
return (0, util_js_1.waitForEvent)(__classPrivateFieldGet(this, _Page_frameManager, "f").networkManager(), NetworkManager_js_1.NetworkManagerEmittedEvents.Request, request => {
|
1203
|
+
if ((0, util_js_1.isString)(urlOrPredicate)) {
|
1265
1204
|
return urlOrPredicate === request.url();
|
1266
|
-
|
1205
|
+
}
|
1206
|
+
if (typeof urlOrPredicate === 'function') {
|
1267
1207
|
return !!urlOrPredicate(request);
|
1208
|
+
}
|
1268
1209
|
return false;
|
1269
|
-
}, timeout, this.
|
1210
|
+
}, timeout, __classPrivateFieldGet(this, _Page_instances, "m", _Page_sessionClosePromise).call(this));
|
1270
1211
|
}
|
1271
1212
|
/**
|
1272
1213
|
* @param urlOrPredicate - A URL or predicate to wait for.
|
1273
1214
|
* @param options - Optional waiting parameters
|
1274
1215
|
* @returns Promise which resolves to the matched response.
|
1275
1216
|
* @example
|
1276
|
-
* ```
|
1217
|
+
* ```ts
|
1277
1218
|
* const firstResponse = await page.waitForResponse(
|
1278
1219
|
* 'https://example.com/resource'
|
1279
1220
|
* );
|
@@ -1294,24 +1235,26 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1294
1235
|
* the {@link Page.setDefaultTimeout} method.
|
1295
1236
|
*/
|
1296
1237
|
async waitForResponse(urlOrPredicate, options = {}) {
|
1297
|
-
const { timeout = this.
|
1298
|
-
return
|
1299
|
-
if (
|
1238
|
+
const { timeout = __classPrivateFieldGet(this, _Page_timeoutSettings, "f").timeout() } = options;
|
1239
|
+
return (0, util_js_1.waitForEvent)(__classPrivateFieldGet(this, _Page_frameManager, "f").networkManager(), NetworkManager_js_1.NetworkManagerEmittedEvents.Response, async (response) => {
|
1240
|
+
if ((0, util_js_1.isString)(urlOrPredicate)) {
|
1300
1241
|
return urlOrPredicate === response.url();
|
1301
|
-
|
1242
|
+
}
|
1243
|
+
if (typeof urlOrPredicate === 'function') {
|
1302
1244
|
return !!(await urlOrPredicate(response));
|
1245
|
+
}
|
1303
1246
|
return false;
|
1304
|
-
}, timeout, this.
|
1247
|
+
}, timeout, __classPrivateFieldGet(this, _Page_instances, "m", _Page_sessionClosePromise).call(this));
|
1305
1248
|
}
|
1306
1249
|
/**
|
1307
1250
|
* @param options - Optional waiting parameters
|
1308
1251
|
* @returns Promise which resolves when network is idle
|
1309
1252
|
*/
|
1310
1253
|
async waitForNetworkIdle(options = {}) {
|
1311
|
-
const { idleTime = 500, timeout = this.
|
1312
|
-
const networkManager = this.
|
1254
|
+
const { idleTime = 500, timeout = __classPrivateFieldGet(this, _Page_timeoutSettings, "f").timeout() } = options;
|
1255
|
+
const networkManager = __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager();
|
1313
1256
|
let idleResolveCallback;
|
1314
|
-
const idlePromise = new Promise(
|
1257
|
+
const idlePromise = new Promise(resolve => {
|
1315
1258
|
idleResolveCallback = resolve;
|
1316
1259
|
});
|
1317
1260
|
let abortRejectCallback;
|
@@ -1319,22 +1262,27 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1319
1262
|
abortRejectCallback = reject;
|
1320
1263
|
});
|
1321
1264
|
let idleTimer;
|
1322
|
-
const onIdle = () =>
|
1265
|
+
const onIdle = () => {
|
1266
|
+
return idleResolveCallback();
|
1267
|
+
};
|
1323
1268
|
const cleanup = () => {
|
1324
1269
|
idleTimer && clearTimeout(idleTimer);
|
1325
1270
|
abortRejectCallback(new Error('abort'));
|
1326
1271
|
};
|
1327
1272
|
const evaluate = () => {
|
1328
1273
|
idleTimer && clearTimeout(idleTimer);
|
1329
|
-
if (networkManager.numRequestsInProgress() === 0)
|
1274
|
+
if (networkManager.numRequestsInProgress() === 0) {
|
1330
1275
|
idleTimer = setTimeout(onIdle, idleTime);
|
1276
|
+
}
|
1331
1277
|
};
|
1332
1278
|
evaluate();
|
1333
1279
|
const eventHandler = () => {
|
1334
1280
|
evaluate();
|
1335
1281
|
return false;
|
1336
1282
|
};
|
1337
|
-
const listenToEvent = (event) =>
|
1283
|
+
const listenToEvent = (event) => {
|
1284
|
+
return (0, util_js_1.waitForEvent)(networkManager, event, eventHandler, timeout, abortPromise);
|
1285
|
+
};
|
1338
1286
|
const eventPromises = [
|
1339
1287
|
listenToEvent(NetworkManager_js_1.NetworkManagerEmittedEvents.Request),
|
1340
1288
|
listenToEvent(NetworkManager_js_1.NetworkManagerEmittedEvents.Response),
|
@@ -1342,11 +1290,11 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1342
1290
|
await Promise.race([
|
1343
1291
|
idlePromise,
|
1344
1292
|
...eventPromises,
|
1345
|
-
this.
|
1346
|
-
]).then(
|
1293
|
+
__classPrivateFieldGet(this, _Page_instances, "m", _Page_sessionClosePromise).call(this),
|
1294
|
+
]).then(r => {
|
1347
1295
|
cleanup();
|
1348
1296
|
return r;
|
1349
|
-
},
|
1297
|
+
}, error => {
|
1350
1298
|
cleanup();
|
1351
1299
|
throw error;
|
1352
1300
|
});
|
@@ -1356,7 +1304,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1356
1304
|
* @param options - Optional waiting parameters
|
1357
1305
|
* @returns Promise which resolves to the matched frame.
|
1358
1306
|
* @example
|
1359
|
-
* ```
|
1307
|
+
* ```ts
|
1360
1308
|
* const frame = await page.waitForFrame(async (frame) => {
|
1361
1309
|
* return frame.name() === 'Test';
|
1362
1310
|
* });
|
@@ -1369,29 +1317,33 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1369
1317
|
* the {@link Page.setDefaultTimeout} method.
|
1370
1318
|
*/
|
1371
1319
|
async waitForFrame(urlOrPredicate, options = {}) {
|
1372
|
-
const { timeout = this.
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1320
|
+
const { timeout = __classPrivateFieldGet(this, _Page_timeoutSettings, "f").timeout() } = options;
|
1321
|
+
let predicate;
|
1322
|
+
if ((0, util_js_1.isString)(urlOrPredicate)) {
|
1323
|
+
predicate = (frame) => {
|
1324
|
+
return Promise.resolve(urlOrPredicate === frame.url());
|
1325
|
+
};
|
1326
|
+
}
|
1327
|
+
else {
|
1328
|
+
predicate = (frame) => {
|
1329
|
+
const value = urlOrPredicate(frame);
|
1330
|
+
if (typeof value === 'boolean') {
|
1331
|
+
return Promise.resolve(value);
|
1332
|
+
}
|
1333
|
+
return value;
|
1334
|
+
};
|
1379
1335
|
}
|
1380
1336
|
const eventRace = Promise.race([
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
(async () => {
|
1387
|
-
for (const frame of this.frames()) {
|
1388
|
-
if (await predicate(frame)) {
|
1389
|
-
return frame;
|
1390
|
-
}
|
1337
|
+
(0, util_js_1.waitForEvent)(__classPrivateFieldGet(this, _Page_frameManager, "f"), FrameManager_js_1.FrameManagerEmittedEvents.FrameAttached, predicate, timeout, __classPrivateFieldGet(this, _Page_instances, "m", _Page_sessionClosePromise).call(this)),
|
1338
|
+
(0, util_js_1.waitForEvent)(__classPrivateFieldGet(this, _Page_frameManager, "f"), FrameManager_js_1.FrameManagerEmittedEvents.FrameNavigated, predicate, timeout, __classPrivateFieldGet(this, _Page_instances, "m", _Page_sessionClosePromise).call(this)),
|
1339
|
+
...this.frames().map(async (frame) => {
|
1340
|
+
if (await predicate(frame)) {
|
1341
|
+
return frame;
|
1391
1342
|
}
|
1392
|
-
await eventRace;
|
1393
|
-
})
|
1343
|
+
return await eventRace;
|
1344
|
+
}),
|
1394
1345
|
]);
|
1346
|
+
return eventRace;
|
1395
1347
|
}
|
1396
1348
|
/**
|
1397
1349
|
* This method navigate to the previous page in history.
|
@@ -1404,25 +1356,23 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1404
1356
|
*
|
1405
1357
|
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1406
1358
|
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1407
|
-
* using the
|
1408
|
-
* {@link Page.
|
1409
|
-
* | page.setDefaultNavigationTimeout(timeout)}
|
1410
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1411
|
-
* methods.
|
1359
|
+
* using the {@link Page.setDefaultNavigationTimeout} or
|
1360
|
+
* {@link Page.setDefaultTimeout} methods.
|
1412
1361
|
*
|
1413
1362
|
* - `waitUntil` : When to consider navigation succeeded, defaults to `load`.
|
1414
1363
|
* Given an array of event strings, navigation is considered to be
|
1415
1364
|
* successful after all events have been fired. Events can be either:<br/>
|
1416
|
-
* - `load` : consider navigation to be finished when the load event is
|
1365
|
+
* - `load` : consider navigation to be finished when the load event is
|
1366
|
+
* fired.<br/>
|
1417
1367
|
* - `domcontentloaded` : consider navigation to be finished when the
|
1418
|
-
*
|
1368
|
+
* DOMContentLoaded event is fired.<br/>
|
1419
1369
|
* - `networkidle0` : consider navigation to be finished when there are no
|
1420
|
-
*
|
1370
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
1421
1371
|
* - `networkidle2` : consider navigation to be finished when there are no
|
1422
|
-
*
|
1372
|
+
* more than 2 network connections for at least `500` ms.
|
1423
1373
|
*/
|
1424
1374
|
async goBack(options = {}) {
|
1425
|
-
return this.
|
1375
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_go).call(this, -1, options);
|
1426
1376
|
}
|
1427
1377
|
/**
|
1428
1378
|
* This method navigate to the next page in history.
|
@@ -1435,52 +1385,42 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1435
1385
|
*
|
1436
1386
|
* - `timeout` : Maximum navigation time in milliseconds, defaults to 30
|
1437
1387
|
* seconds, pass 0 to disable timeout. The default value can be changed by
|
1438
|
-
* using the
|
1439
|
-
* {@link Page.
|
1440
|
-
* | page.setDefaultNavigationTimeout(timeout)}
|
1441
|
-
* or {@link Page.setDefaultTimeout | page.setDefaultTimeout(timeout)}
|
1442
|
-
* methods.
|
1388
|
+
* using the {@link Page.setDefaultNavigationTimeout} or
|
1389
|
+
* {@link Page.setDefaultTimeout} methods.
|
1443
1390
|
*
|
1444
1391
|
* - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
|
1445
1392
|
* Given an array of event strings, navigation is considered to be
|
1446
1393
|
* successful after all events have been fired. Events can be either:<br/>
|
1447
|
-
* - `load` : consider navigation to be finished when the load event is
|
1394
|
+
* - `load` : consider navigation to be finished when the load event is
|
1395
|
+
* fired.<br/>
|
1448
1396
|
* - `domcontentloaded` : consider navigation to be finished when the
|
1449
|
-
*
|
1397
|
+
* DOMContentLoaded event is fired.<br/>
|
1450
1398
|
* - `networkidle0` : consider navigation to be finished when there are no
|
1451
|
-
*
|
1399
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
1452
1400
|
* - `networkidle2` : consider navigation to be finished when there are no
|
1453
|
-
*
|
1401
|
+
* more than 2 network connections for at least `500` ms.
|
1454
1402
|
*/
|
1455
1403
|
async goForward(options = {}) {
|
1456
|
-
return this.
|
1457
|
-
}
|
1458
|
-
async _go(delta, options) {
|
1459
|
-
const history = await this._client.send('Page.getNavigationHistory');
|
1460
|
-
const entry = history.entries[history.currentIndex + delta];
|
1461
|
-
if (!entry)
|
1462
|
-
return null;
|
1463
|
-
const result = await Promise.all([
|
1464
|
-
this.waitForNavigation(options),
|
1465
|
-
this._client.send('Page.navigateToHistoryEntry', { entryId: entry.id }),
|
1466
|
-
]);
|
1467
|
-
return result[0];
|
1404
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_go).call(this, +1, options);
|
1468
1405
|
}
|
1469
1406
|
/**
|
1470
1407
|
* Brings page to front (activates tab).
|
1471
1408
|
*/
|
1472
1409
|
async bringToFront() {
|
1473
|
-
await this.
|
1410
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.bringToFront');
|
1474
1411
|
}
|
1475
1412
|
/**
|
1476
|
-
* Emulates given device metrics and user agent.
|
1477
|
-
*
|
1478
|
-
*
|
1479
|
-
*
|
1480
|
-
*
|
1481
|
-
*
|
1413
|
+
* Emulates given device metrics and user agent.
|
1414
|
+
*
|
1415
|
+
* @remarks
|
1416
|
+
* This method is a shortcut for calling two methods:
|
1417
|
+
* {@link Page.setUserAgent} and {@link Page.setViewport} To aid emulation,
|
1418
|
+
* Puppeteer provides a list of device descriptors that can be obtained via
|
1419
|
+
* {@link devices}. `page.emulate` will resize the page. A lot of websites
|
1420
|
+
* don't expect phones to change size, so you should emulate before navigating
|
1421
|
+
* to the page.
|
1482
1422
|
* @example
|
1483
|
-
* ```
|
1423
|
+
* ```ts
|
1484
1424
|
* const puppeteer = require('puppeteer');
|
1485
1425
|
* const iPhone = puppeteer.devices['iPhone 6'];
|
1486
1426
|
* (async () => {
|
@@ -1509,10 +1449,11 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1509
1449
|
* It will take full effect on the next navigation.
|
1510
1450
|
*/
|
1511
1451
|
async setJavaScriptEnabled(enabled) {
|
1512
|
-
if (this
|
1452
|
+
if (__classPrivateFieldGet(this, _Page_javascriptEnabled, "f") === enabled) {
|
1513
1453
|
return;
|
1514
|
-
|
1515
|
-
|
1454
|
+
}
|
1455
|
+
__classPrivateFieldSet(this, _Page_javascriptEnabled, enabled, "f");
|
1456
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setScriptExecutionDisabled', {
|
1516
1457
|
value: !enabled,
|
1517
1458
|
});
|
1518
1459
|
}
|
@@ -1525,14 +1466,14 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1525
1466
|
* before navigating to the domain.
|
1526
1467
|
*/
|
1527
1468
|
async setBypassCSP(enabled) {
|
1528
|
-
await this.
|
1469
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.setBypassCSP', { enabled });
|
1529
1470
|
}
|
1530
1471
|
/**
|
1531
1472
|
* @param type - Changes the CSS media type of the page. The only allowed
|
1532
1473
|
* values are `screen`, `print` and `null`. Passing `null` disables CSS media
|
1533
1474
|
* emulation.
|
1534
1475
|
* @example
|
1535
|
-
* ```
|
1476
|
+
* ```ts
|
1536
1477
|
* await page.evaluate(() => matchMedia('screen').matches);
|
1537
1478
|
* // → true
|
1538
1479
|
* await page.evaluate(() => matchMedia('print').matches);
|
@@ -1552,8 +1493,10 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1552
1493
|
* ```
|
1553
1494
|
*/
|
1554
1495
|
async emulateMediaType(type) {
|
1555
|
-
(0, assert_js_1.assert)(type === 'screen' ||
|
1556
|
-
|
1496
|
+
(0, assert_js_1.assert)(type === 'screen' ||
|
1497
|
+
type === 'print' ||
|
1498
|
+
(type !== null && type !== void 0 ? type : undefined) === undefined, 'Unsupported media type: ' + type);
|
1499
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setEmulatedMedia', {
|
1557
1500
|
media: type || '',
|
1558
1501
|
});
|
1559
1502
|
}
|
@@ -1563,7 +1506,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1563
1506
|
*/
|
1564
1507
|
async emulateCPUThrottling(factor) {
|
1565
1508
|
(0, assert_js_1.assert)(factor === null || factor >= 1, 'Throttling rate should be greater or equal to 1');
|
1566
|
-
await this.
|
1509
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setCPUThrottlingRate', {
|
1567
1510
|
rate: factor !== null ? factor : 1,
|
1568
1511
|
});
|
1569
1512
|
}
|
@@ -1572,7 +1515,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1572
1515
|
* objects, emulates CSS media features on the page. Each media feature object
|
1573
1516
|
* must have the following properties:
|
1574
1517
|
* @example
|
1575
|
-
* ```
|
1518
|
+
* ```ts
|
1576
1519
|
* await page.emulateMediaFeatures([
|
1577
1520
|
* { name: 'prefers-color-scheme', value: 'dark' },
|
1578
1521
|
* ]);
|
@@ -1620,15 +1563,15 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1620
1563
|
* ```
|
1621
1564
|
*/
|
1622
1565
|
async emulateMediaFeatures(features) {
|
1623
|
-
if (features
|
1624
|
-
await this.
|
1566
|
+
if (!features) {
|
1567
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setEmulatedMedia', {});
|
1568
|
+
}
|
1625
1569
|
if (Array.isArray(features)) {
|
1626
|
-
|
1570
|
+
for (const mediaFeature of features) {
|
1627
1571
|
const name = mediaFeature.name;
|
1628
1572
|
(0, assert_js_1.assert)(/^(?:prefers-(?:color-scheme|reduced-motion)|color-gamut)$/.test(name), 'Unsupported media feature: ' + name);
|
1629
|
-
|
1630
|
-
|
1631
|
-
await this._client.send('Emulation.setEmulatedMedia', {
|
1573
|
+
}
|
1574
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setEmulatedMedia', {
|
1632
1575
|
features: features,
|
1633
1576
|
});
|
1634
1577
|
}
|
@@ -1641,13 +1584,14 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1641
1584
|
*/
|
1642
1585
|
async emulateTimezone(timezoneId) {
|
1643
1586
|
try {
|
1644
|
-
await this.
|
1587
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setTimezoneOverride', {
|
1645
1588
|
timezoneId: timezoneId || '',
|
1646
1589
|
});
|
1647
1590
|
}
|
1648
1591
|
catch (error) {
|
1649
|
-
if (error.message.includes('Invalid timezone'))
|
1592
|
+
if ((0, util_js_1.isErrorLike)(error) && error.message.includes('Invalid timezone')) {
|
1650
1593
|
throw new Error(`Invalid timezone ID: ${timezoneId}`);
|
1594
|
+
}
|
1651
1595
|
throw error;
|
1652
1596
|
}
|
1653
1597
|
}
|
@@ -1656,7 +1600,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1656
1600
|
* If no arguments set, clears idle state emulation.
|
1657
1601
|
*
|
1658
1602
|
* @example
|
1659
|
-
* ```
|
1603
|
+
* ```ts
|
1660
1604
|
* // set idle emulation
|
1661
1605
|
* await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
|
1662
1606
|
*
|
@@ -1671,20 +1615,20 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1671
1615
|
*/
|
1672
1616
|
async emulateIdleState(overrides) {
|
1673
1617
|
if (overrides) {
|
1674
|
-
await this.
|
1618
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setIdleOverride', {
|
1675
1619
|
isUserActive: overrides.isUserActive,
|
1676
1620
|
isScreenUnlocked: overrides.isScreenUnlocked,
|
1677
1621
|
});
|
1678
1622
|
}
|
1679
1623
|
else {
|
1680
|
-
await this.
|
1624
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.clearIdleOverride');
|
1681
1625
|
}
|
1682
1626
|
}
|
1683
1627
|
/**
|
1684
1628
|
* Simulates the given vision deficiency on the page.
|
1685
1629
|
*
|
1686
1630
|
* @example
|
1687
|
-
* ```
|
1631
|
+
* ```ts
|
1688
1632
|
* const puppeteer = require('puppeteer');
|
1689
1633
|
*
|
1690
1634
|
* (async () => {
|
@@ -1718,7 +1662,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1718
1662
|
]);
|
1719
1663
|
try {
|
1720
1664
|
(0, assert_js_1.assert)(!type || visionDeficiencies.has(type), `Unsupported vision deficiency: ${type}`);
|
1721
|
-
await this.
|
1665
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setEmulatedVisionDeficiency', {
|
1722
1666
|
type: type || 'none',
|
1723
1667
|
});
|
1724
1668
|
}
|
@@ -1734,7 +1678,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1734
1678
|
* In the case of multiple pages in a single browser, each page can have its
|
1735
1679
|
* own viewport size.
|
1736
1680
|
* @example
|
1737
|
-
* ```
|
1681
|
+
* ```ts
|
1738
1682
|
* const page = await browser.newPage();
|
1739
1683
|
* await page.setViewport({
|
1740
1684
|
* width: 640,
|
@@ -1766,10 +1710,11 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1766
1710
|
* set the isMobile or hasTouch properties.
|
1767
1711
|
*/
|
1768
1712
|
async setViewport(viewport) {
|
1769
|
-
const needsReload = await this.
|
1770
|
-
this
|
1771
|
-
if (needsReload)
|
1713
|
+
const needsReload = await __classPrivateFieldGet(this, _Page_emulationManager, "f").emulateViewport(viewport);
|
1714
|
+
__classPrivateFieldSet(this, _Page_viewport, viewport, "f");
|
1715
|
+
if (needsReload) {
|
1772
1716
|
await this.reload();
|
1717
|
+
}
|
1773
1718
|
}
|
1774
1719
|
/**
|
1775
1720
|
* @returns
|
@@ -1791,7 +1736,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1791
1736
|
* `false`.
|
1792
1737
|
*/
|
1793
1738
|
viewport() {
|
1794
|
-
return this
|
1739
|
+
return __classPrivateFieldGet(this, _Page_viewport, "f");
|
1795
1740
|
}
|
1796
1741
|
/**
|
1797
1742
|
* @remarks
|
@@ -1803,7 +1748,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1803
1748
|
*
|
1804
1749
|
* @example
|
1805
1750
|
*
|
1806
|
-
* ```
|
1751
|
+
* ```ts
|
1807
1752
|
* const result = await frame.evaluate(() => {
|
1808
1753
|
* return Promise.resolve(8 * 7);
|
1809
1754
|
* });
|
@@ -1814,15 +1759,15 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1814
1759
|
* recommended as they are easier to debug and use with TypeScript):
|
1815
1760
|
*
|
1816
1761
|
* @example
|
1817
|
-
* ```
|
1762
|
+
* ```ts
|
1818
1763
|
* const aHandle = await page.evaluate('1 + 2');
|
1819
1764
|
* ```
|
1820
1765
|
*
|
1821
1766
|
* To get the best TypeScript experience, you should pass in as the
|
1822
1767
|
* generic the type of `pageFunction`:
|
1823
1768
|
*
|
1824
|
-
* ```
|
1825
|
-
* const aHandle = await page.evaluate
|
1769
|
+
* ```ts
|
1770
|
+
* const aHandle = await page.evaluate(() => 2);
|
1826
1771
|
* ```
|
1827
1772
|
*
|
1828
1773
|
* @example
|
@@ -1830,7 +1775,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1830
1775
|
* {@link ElementHandle} instances (including {@link JSHandle}s) can be passed
|
1831
1776
|
* as arguments to the `pageFunction`:
|
1832
1777
|
*
|
1833
|
-
* ```
|
1778
|
+
* ```ts
|
1834
1779
|
* const bodyHandle = await page.$('body');
|
1835
1780
|
* const html = await page.evaluate(body => body.innerHTML, bodyHandle);
|
1836
1781
|
* await bodyHandle.dispose();
|
@@ -1842,7 +1787,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1842
1787
|
* @returns the return value of `pageFunction`.
|
1843
1788
|
*/
|
1844
1789
|
async evaluate(pageFunction, ...args) {
|
1845
|
-
return this.
|
1790
|
+
return __classPrivateFieldGet(this, _Page_frameManager, "f").mainFrame().evaluate(pageFunction, ...args);
|
1846
1791
|
}
|
1847
1792
|
/**
|
1848
1793
|
* Adds a function which would be invoked in one of the following scenarios:
|
@@ -1859,7 +1804,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1859
1804
|
* @param args - Arguments to pass to `pageFunction`
|
1860
1805
|
* @example
|
1861
1806
|
* An example of overriding the navigator.languages property before the page loads:
|
1862
|
-
* ```
|
1807
|
+
* ```ts
|
1863
1808
|
* // preload.js
|
1864
1809
|
*
|
1865
1810
|
* // overwrite the `languages` property to use a custom getter
|
@@ -1876,8 +1821,8 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1876
1821
|
* ```
|
1877
1822
|
*/
|
1878
1823
|
async evaluateOnNewDocument(pageFunction, ...args) {
|
1879
|
-
const source =
|
1880
|
-
await this.
|
1824
|
+
const source = (0, util_js_1.evaluationString)(pageFunction, ...args);
|
1825
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.addScriptToEvaluateOnNewDocument', {
|
1881
1826
|
source,
|
1882
1827
|
});
|
1883
1828
|
}
|
@@ -1887,7 +1832,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1887
1832
|
* @param enabled - sets the `enabled` state of cache
|
1888
1833
|
*/
|
1889
1834
|
async setCacheEnabled(enabled = true) {
|
1890
|
-
await this.
|
1835
|
+
await __classPrivateFieldGet(this, _Page_frameManager, "f").networkManager().setCacheEnabled(enabled);
|
1891
1836
|
}
|
1892
1837
|
/**
|
1893
1838
|
* @remarks
|
@@ -1907,7 +1852,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1907
1852
|
* applicable to `png` images.
|
1908
1853
|
*
|
1909
1854
|
* - `fullPage` : When true, takes a screenshot of the full
|
1910
|
-
* scrollable page. Defaults to `false
|
1855
|
+
* scrollable page. Defaults to `false`.
|
1911
1856
|
*
|
1912
1857
|
* - `clip` : An object which specifies clipping region of the page.
|
1913
1858
|
* Should have the following fields:<br/>
|
@@ -1917,11 +1862,21 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1917
1862
|
* - `height` : height of clipping area.
|
1918
1863
|
*
|
1919
1864
|
* - `omitBackground` : Hides default white background and allows
|
1920
|
-
* capturing screenshots with transparency. Defaults to `false
|
1865
|
+
* capturing screenshots with transparency. Defaults to `false`.
|
1921
1866
|
*
|
1922
1867
|
* - `encoding` : The encoding of the image, can be either base64 or
|
1923
1868
|
* binary. Defaults to `binary`.
|
1924
1869
|
*
|
1870
|
+
* - `captureBeyondViewport` : When true, captures screenshot
|
1871
|
+
* {@link https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot
|
1872
|
+
* | beyond the viewport}. When false, falls back to old behaviour,
|
1873
|
+
* and cuts the screenshot by the viewport size. Defaults to `true`.
|
1874
|
+
*
|
1875
|
+
* - `fromSurface` : When true, captures screenshot
|
1876
|
+
* {@link https://chromedevtools.github.io/devtools-protocol/tot/Page/#method-captureScreenshot
|
1877
|
+
* | from the surface rather than the view}. When false, works only in
|
1878
|
+
* headful mode and ignores page viewport (but not browser window's
|
1879
|
+
* bounds). Defaults to `true`.
|
1925
1880
|
*
|
1926
1881
|
* NOTE: Screenshots take at least 1/6 second on OS X. See
|
1927
1882
|
* {@link https://crbug.com/741689} for discussion.
|
@@ -1929,34 +1884,37 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1929
1884
|
* the value of `encoding`) with captured screenshot.
|
1930
1885
|
*/
|
1931
1886
|
async screenshot(options = {}) {
|
1932
|
-
let screenshotType =
|
1887
|
+
let screenshotType = "png" /* Protocol.Page.CaptureScreenshotRequestFormat.Png */;
|
1933
1888
|
// options.type takes precedence over inferring the type from options.path
|
1934
1889
|
// because it may be a 0-length file with no extension created beforehand
|
1935
1890
|
// (i.e. as a temp file).
|
1936
1891
|
if (options.type) {
|
1937
|
-
|
1938
|
-
|
1939
|
-
(0, assert_js_1.assertNever)(type, 'Unknown options.type value: ' + type);
|
1940
|
-
}
|
1941
|
-
screenshotType = options.type;
|
1892
|
+
screenshotType =
|
1893
|
+
options.type;
|
1942
1894
|
}
|
1943
1895
|
else if (options.path) {
|
1944
1896
|
const filePath = options.path;
|
1945
1897
|
const extension = filePath
|
1946
1898
|
.slice(filePath.lastIndexOf('.') + 1)
|
1947
1899
|
.toLowerCase();
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1900
|
+
switch (extension) {
|
1901
|
+
case 'png':
|
1902
|
+
screenshotType = "png" /* Protocol.Page.CaptureScreenshotRequestFormat.Png */;
|
1903
|
+
break;
|
1904
|
+
case 'jpeg':
|
1905
|
+
case 'jpg':
|
1906
|
+
screenshotType = "jpeg" /* Protocol.Page.CaptureScreenshotRequestFormat.Jpeg */;
|
1907
|
+
break;
|
1908
|
+
case 'webp':
|
1909
|
+
screenshotType = "webp" /* Protocol.Page.CaptureScreenshotRequestFormat.Webp */;
|
1910
|
+
break;
|
1911
|
+
default:
|
1912
|
+
throw new Error(`Unsupported screenshot type for extension \`.${extension}\``);
|
1913
|
+
}
|
1955
1914
|
}
|
1956
|
-
if (!screenshotType)
|
1957
|
-
screenshotType = 'png';
|
1958
1915
|
if (options.quality) {
|
1959
|
-
(0, assert_js_1.assert)(screenshotType ===
|
1916
|
+
(0, assert_js_1.assert)(screenshotType === "jpeg" /* Protocol.Page.CaptureScreenshotRequestFormat.Jpeg */ ||
|
1917
|
+
screenshotType === "webp" /* Protocol.Page.CaptureScreenshotRequestFormat.Webp */, 'options.quality is unsupported for the ' +
|
1960
1918
|
screenshotType +
|
1961
1919
|
' screenshots');
|
1962
1920
|
(0, assert_js_1.assert)(typeof options.quality === 'number', 'Expected options.quality to be a number but found ' +
|
@@ -1978,69 +1936,9 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
1978
1936
|
(0, assert_js_1.assert)(options.clip.width !== 0, 'Expected options.clip.width not to be 0.');
|
1979
1937
|
(0, assert_js_1.assert)(options.clip.height !== 0, 'Expected options.clip.height not to be 0.');
|
1980
1938
|
}
|
1981
|
-
return this.
|
1982
|
-
|
1983
|
-
async _screenshotTask(format, options) {
|
1984
|
-
await this._client.send('Target.activateTarget', {
|
1985
|
-
targetId: this._target._targetId,
|
1986
|
-
});
|
1987
|
-
let clip = options.clip ? processClip(options.clip) : undefined;
|
1988
|
-
let { captureBeyondViewport = true } = options;
|
1989
|
-
captureBeyondViewport =
|
1990
|
-
typeof captureBeyondViewport === 'boolean' ? captureBeyondViewport : true;
|
1991
|
-
if (options.fullPage) {
|
1992
|
-
const metrics = await this._client.send('Page.getLayoutMetrics');
|
1993
|
-
// Fallback to `contentSize` in case of using Firefox.
|
1994
|
-
const { width, height } = metrics.cssContentSize || metrics.contentSize;
|
1995
|
-
// Overwrite clip for full page.
|
1996
|
-
clip = { x: 0, y: 0, width, height, scale: 1 };
|
1997
|
-
if (!captureBeyondViewport) {
|
1998
|
-
const { isMobile = false, deviceScaleFactor = 1, isLandscape = false, } = this._viewport || {};
|
1999
|
-
const screenOrientation = isLandscape
|
2000
|
-
? { angle: 90, type: 'landscapePrimary' }
|
2001
|
-
: { angle: 0, type: 'portraitPrimary' };
|
2002
|
-
await this._client.send('Emulation.setDeviceMetricsOverride', {
|
2003
|
-
mobile: isMobile,
|
2004
|
-
width,
|
2005
|
-
height,
|
2006
|
-
deviceScaleFactor,
|
2007
|
-
screenOrientation,
|
2008
|
-
});
|
2009
|
-
}
|
2010
|
-
}
|
2011
|
-
const shouldSetDefaultBackground = options.omitBackground && (format === 'png' || format === 'webp');
|
2012
|
-
if (shouldSetDefaultBackground) {
|
2013
|
-
await this._setTransparentBackgroundColor();
|
2014
|
-
}
|
2015
|
-
const result = await this._client.send('Page.captureScreenshot', {
|
2016
|
-
format,
|
2017
|
-
quality: options.quality,
|
2018
|
-
clip,
|
2019
|
-
captureBeyondViewport,
|
1939
|
+
return __classPrivateFieldGet(this, _Page_screenshotTaskQueue, "f").postTask(() => {
|
1940
|
+
return __classPrivateFieldGet(this, _Page_instances, "m", _Page_screenshotTask).call(this, screenshotType, options);
|
2020
1941
|
});
|
2021
|
-
if (shouldSetDefaultBackground) {
|
2022
|
-
await this._resetDefaultBackgroundColor();
|
2023
|
-
}
|
2024
|
-
if (options.fullPage && this._viewport)
|
2025
|
-
await this.setViewport(this._viewport);
|
2026
|
-
const buffer = options.encoding === 'base64'
|
2027
|
-
? result.data
|
2028
|
-
: Buffer.from(result.data, 'base64');
|
2029
|
-
if (options.path) {
|
2030
|
-
if (!environment_js_1.isNode) {
|
2031
|
-
throw new Error('Screenshots can only be written to a file path in a Node environment.');
|
2032
|
-
}
|
2033
|
-
const fs = await helper_js_1.helper.importFSModule();
|
2034
|
-
await fs.promises.writeFile(options.path, buffer);
|
2035
|
-
}
|
2036
|
-
return buffer;
|
2037
|
-
function processClip(clip) {
|
2038
|
-
const x = Math.round(clip.x);
|
2039
|
-
const y = Math.round(clip.y);
|
2040
|
-
const width = Math.round(clip.width + clip.x - x);
|
2041
|
-
const height = Math.round(clip.height + clip.y - y);
|
2042
|
-
return { x, y, width, height, scale: 1 };
|
2043
|
-
}
|
2044
1942
|
}
|
2045
1943
|
/**
|
2046
1944
|
* Generates a PDF of the page with the `print` CSS media type.
|
@@ -2065,7 +1963,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2065
1963
|
let paperWidth = 8.5;
|
2066
1964
|
let paperHeight = 11;
|
2067
1965
|
if (options.format) {
|
2068
|
-
const format = PDFOptions_js_1.
|
1966
|
+
const format = PDFOptions_js_1._paperFormats[options.format.toLowerCase()];
|
2069
1967
|
(0, assert_js_1.assert)(format, 'Unknown paper format: ' + options.format);
|
2070
1968
|
paperWidth = format.width;
|
2071
1969
|
paperHeight = format.height;
|
@@ -2080,9 +1978,9 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2080
1978
|
const marginBottom = convertPrintParameterToInches(margin.bottom) || 0;
|
2081
1979
|
const marginRight = convertPrintParameterToInches(margin.right) || 0;
|
2082
1980
|
if (omitBackground) {
|
2083
|
-
await this.
|
1981
|
+
await __classPrivateFieldGet(this, _Page_instances, "m", _Page_setTransparentBackgroundColor).call(this);
|
2084
1982
|
}
|
2085
|
-
const printCommandPromise = this.
|
1983
|
+
const printCommandPromise = __classPrivateFieldGet(this, _Page_client, "f").send('Page.printToPDF', {
|
2086
1984
|
transferMode: 'ReturnAsStream',
|
2087
1985
|
landscape,
|
2088
1986
|
displayHeaderFooter,
|
@@ -2099,11 +1997,12 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2099
1997
|
pageRanges,
|
2100
1998
|
preferCSSPageSize,
|
2101
1999
|
});
|
2102
|
-
const result = await
|
2000
|
+
const result = await (0, util_js_1.waitWithTimeout)(printCommandPromise, 'Page.printToPDF', timeout);
|
2103
2001
|
if (omitBackground) {
|
2104
|
-
await this.
|
2002
|
+
await __classPrivateFieldGet(this, _Page_instances, "m", _Page_resetDefaultBackgroundColor).call(this);
|
2105
2003
|
}
|
2106
|
-
|
2004
|
+
(0, assert_js_1.assert)(result.stream, '`stream` is missing from `Page.printToPDF');
|
2005
|
+
return (0, util_js_1.getReadableFromProtocolStream)(__classPrivateFieldGet(this, _Page_client, "f"), result.stream);
|
2107
2006
|
}
|
2108
2007
|
/**
|
2109
2008
|
* @param options -
|
@@ -2112,7 +2011,9 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2112
2011
|
async pdf(options = {}) {
|
2113
2012
|
const { path = undefined } = options;
|
2114
2013
|
const readable = await this.createPDFStream(options);
|
2115
|
-
|
2014
|
+
const buffer = await (0, util_js_1.getReadableAsBuffer)(readable, path);
|
2015
|
+
(0, assert_js_1.assert)(buffer, 'Could not create buffer');
|
2016
|
+
return buffer;
|
2116
2017
|
}
|
2117
2018
|
/**
|
2118
2019
|
* @returns The page's title
|
@@ -2123,16 +2024,17 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2123
2024
|
return this.mainFrame().title();
|
2124
2025
|
}
|
2125
2026
|
async close(options = { runBeforeUnload: undefined }) {
|
2126
|
-
|
2027
|
+
const connection = __classPrivateFieldGet(this, _Page_client, "f").connection();
|
2028
|
+
(0, assert_js_1.assert)(connection, 'Protocol error: Connection closed. Most likely the page has been closed.');
|
2127
2029
|
const runBeforeUnload = !!options.runBeforeUnload;
|
2128
2030
|
if (runBeforeUnload) {
|
2129
|
-
await this.
|
2031
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Page.close');
|
2130
2032
|
}
|
2131
2033
|
else {
|
2132
|
-
await
|
2133
|
-
targetId: this.
|
2034
|
+
await connection.send('Target.closeTarget', {
|
2035
|
+
targetId: __classPrivateFieldGet(this, _Page_target, "f")._targetId,
|
2134
2036
|
});
|
2135
|
-
await this.
|
2037
|
+
await __classPrivateFieldGet(this, _Page_target, "f")._isClosedPromise;
|
2136
2038
|
}
|
2137
2039
|
}
|
2138
2040
|
/**
|
@@ -2140,10 +2042,10 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2140
2042
|
* @returns
|
2141
2043
|
*/
|
2142
2044
|
isClosed() {
|
2143
|
-
return this
|
2045
|
+
return __classPrivateFieldGet(this, _Page_closed, "f");
|
2144
2046
|
}
|
2145
2047
|
get mouse() {
|
2146
|
-
return this
|
2048
|
+
return __classPrivateFieldGet(this, _Page_mouse, "f");
|
2147
2049
|
}
|
2148
2050
|
/**
|
2149
2051
|
* This method fetches an element with `selector`, scrolls it into view if
|
@@ -2154,7 +2056,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2154
2056
|
* there's a separate `page.waitForNavigation()` promise to be resolved, you
|
2155
2057
|
* may end up with a race condition that yields unexpected results. The
|
2156
2058
|
* correct pattern for click and wait for navigation is the following:
|
2157
|
-
* ```
|
2059
|
+
* ```ts
|
2158
2060
|
* const [response] = await Promise.all([
|
2159
2061
|
* page.waitForNavigation(waitOptions),
|
2160
2062
|
* page.click(selector, clickOptions),
|
@@ -2210,7 +2112,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2210
2112
|
* throws an error.
|
2211
2113
|
*
|
2212
2114
|
* @example
|
2213
|
-
* ```
|
2115
|
+
* ```ts
|
2214
2116
|
* page.select('select#colors', 'blue'); // single selection
|
2215
2117
|
* page.select('select#colors', 'red', 'green', 'blue'); // multiple selections
|
2216
2118
|
* ```
|
@@ -2249,7 +2151,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2249
2151
|
*
|
2250
2152
|
* To press a special key, like `Control` or `ArrowDown`, use {@link Keyboard.press}.
|
2251
2153
|
* @example
|
2252
|
-
* ```
|
2154
|
+
* ```ts
|
2253
2155
|
* await page.type('#mytextarea', 'Hello');
|
2254
2156
|
* // Types instantly
|
2255
2157
|
* await page.type('#mytextarea', 'World', { delay: 100 });
|
@@ -2268,34 +2170,6 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2268
2170
|
type(selector, text, options) {
|
2269
2171
|
return this.mainFrame().type(selector, text, options);
|
2270
2172
|
}
|
2271
|
-
/**
|
2272
|
-
* @remarks
|
2273
|
-
*
|
2274
|
-
* This method behaves differently depending on the first parameter. If it's a
|
2275
|
-
* `string`, it will be treated as a `selector` or `xpath` (if the string
|
2276
|
-
* starts with `//`). This method then is a shortcut for
|
2277
|
-
* {@link Page.waitForSelector} or {@link Page.waitForXPath}.
|
2278
|
-
*
|
2279
|
-
* If the first argument is a function this method is a shortcut for
|
2280
|
-
* {@link Page.waitForFunction}.
|
2281
|
-
*
|
2282
|
-
* If the first argument is a `number`, it's treated as a timeout in
|
2283
|
-
* milliseconds and the method returns a promise which resolves after the
|
2284
|
-
* timeout.
|
2285
|
-
*
|
2286
|
-
* @param selectorOrFunctionOrTimeout - a selector, predicate or timeout to
|
2287
|
-
* wait for.
|
2288
|
-
* @param options - optional waiting parameters.
|
2289
|
-
* @param args - arguments to pass to `pageFunction`.
|
2290
|
-
*
|
2291
|
-
* @deprecated Don't use this method directly. Instead use the more explicit
|
2292
|
-
* methods available: {@link Page.waitForSelector},
|
2293
|
-
* {@link Page.waitForXPath}, {@link Page.waitForFunction} or
|
2294
|
-
* {@link Page.waitForTimeout}.
|
2295
|
-
*/
|
2296
|
-
waitFor(selectorOrFunctionOrTimeout, options = {}, ...args) {
|
2297
|
-
return this.mainFrame().waitFor(selectorOrFunctionOrTimeout, options, ...args);
|
2298
|
-
}
|
2299
2173
|
/**
|
2300
2174
|
* Causes your script to wait for the given number of milliseconds.
|
2301
2175
|
*
|
@@ -2309,7 +2183,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2309
2183
|
*
|
2310
2184
|
* Wait for 1 second:
|
2311
2185
|
*
|
2312
|
-
* ```
|
2186
|
+
* ```ts
|
2313
2187
|
* await page.waitForTimeout(1000);
|
2314
2188
|
* ```
|
2315
2189
|
*
|
@@ -2325,7 +2199,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2325
2199
|
* function will throw.
|
2326
2200
|
*
|
2327
2201
|
* This method works across navigations:
|
2328
|
-
* ```
|
2202
|
+
* ```ts
|
2329
2203
|
* const puppeteer = require('puppeteer');
|
2330
2204
|
* (async () => {
|
2331
2205
|
* const browser = await puppeteer.launch();
|
@@ -2366,8 +2240,8 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2366
2240
|
* (30 seconds). Pass `0` to disable timeout. The default value can be changed
|
2367
2241
|
* by using the {@link Page.setDefaultTimeout} method.
|
2368
2242
|
*/
|
2369
|
-
waitForSelector(selector, options = {}) {
|
2370
|
-
return this.mainFrame().waitForSelector(selector, options);
|
2243
|
+
async waitForSelector(selector, options = {}) {
|
2244
|
+
return await this.mainFrame().waitForSelector(selector, options);
|
2371
2245
|
}
|
2372
2246
|
/**
|
2373
2247
|
* Wait for the `xpath` to appear in page. If at the moment of calling the
|
@@ -2376,7 +2250,7 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2376
2250
|
* function will throw.
|
2377
2251
|
*
|
2378
2252
|
* This method works across navigation
|
2379
|
-
* ```
|
2253
|
+
* ```ts
|
2380
2254
|
* const puppeteer = require('puppeteer');
|
2381
2255
|
* (async () => {
|
2382
2256
|
* const browser = await puppeteer.launch();
|
@@ -2421,9 +2295,12 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2421
2295
|
return this.mainFrame().waitForXPath(xpath, options);
|
2422
2296
|
}
|
2423
2297
|
/**
|
2424
|
-
*
|
2298
|
+
* Waits for a function to finish evaluating in the page's context.
|
2425
2299
|
*
|
2426
|
-
*
|
2300
|
+
* @example
|
2301
|
+
* The {@link Page.waitForFunction} can be used to observe viewport size change:
|
2302
|
+
*
|
2303
|
+
* ```ts
|
2427
2304
|
* const puppeteer = require('puppeteer');
|
2428
2305
|
* (async () => {
|
2429
2306
|
* const browser = await puppeteer.launch();
|
@@ -2434,8 +2311,11 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2434
2311
|
* await browser.close();
|
2435
2312
|
* })();
|
2436
2313
|
* ```
|
2437
|
-
*
|
2438
|
-
*
|
2314
|
+
*
|
2315
|
+
* @example
|
2316
|
+
* To pass arguments from node.js to the predicate of
|
2317
|
+
* {@link Page.waitForFunction} function:
|
2318
|
+
* ```ts
|
2439
2319
|
* const selector = '.foo';
|
2440
2320
|
* await page.waitForFunction(
|
2441
2321
|
* (selector) => !!document.querySelector(selector),
|
@@ -2443,8 +2323,10 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2443
2323
|
* selector
|
2444
2324
|
* );
|
2445
2325
|
* ```
|
2446
|
-
*
|
2447
|
-
*
|
2326
|
+
*
|
2327
|
+
* @example
|
2328
|
+
* The predicate of {@link Page.waitForFunction} can be asynchronous too:
|
2329
|
+
* ```ts
|
2448
2330
|
* const username = 'github-username';
|
2449
2331
|
* await page.waitForFunction(
|
2450
2332
|
* async (username) => {
|
@@ -2463,34 +2345,292 @@ class Page extends EventEmitter_js_1.EventEmitter {
|
|
2463
2345
|
* username
|
2464
2346
|
* );
|
2465
2347
|
* ```
|
2348
|
+
*
|
2466
2349
|
* @param pageFunction - Function to be evaluated in browser context
|
2467
2350
|
* @param options - Optional waiting parameters
|
2468
|
-
*
|
2469
|
-
*
|
2470
|
-
* value. It resolves to a JSHandle of the truthy value.
|
2471
|
-
*
|
2472
|
-
* The optional waiting parameter can be:
|
2473
|
-
*
|
2474
|
-
* - `Polling`: An interval at which the `pageFunction` is executed, defaults to
|
2475
|
-
* `raf`. If `polling` is a number, then it is treated as an interval in
|
2351
|
+
* - `polling` - An interval at which the `pageFunction` is executed, defaults
|
2352
|
+
* to `raf`. If `polling` is a number, then it is treated as an interval in
|
2476
2353
|
* milliseconds at which the function would be executed. If polling is a
|
2477
|
-
* string, then it can be one of the following values
|
2478
|
-
* - `raf
|
2479
|
-
* callback. This is the tightest polling mode
|
2480
|
-
* observe styling changes
|
2481
|
-
* - `mutation
|
2482
|
-
*
|
2483
|
-
*
|
2484
|
-
*
|
2485
|
-
*
|
2486
|
-
*
|
2487
|
-
*
|
2354
|
+
* string, then it can be one of the following values:
|
2355
|
+
* - `raf` - to constantly execute `pageFunction` in
|
2356
|
+
* `requestAnimationFrame` callback. This is the tightest polling mode
|
2357
|
+
* which is suitable to observe styling changes.
|
2358
|
+
* - `mutation`- to execute pageFunction on every DOM mutation.
|
2359
|
+
* - `timeout` - maximum time to wait for in milliseconds. Defaults to `30000`
|
2360
|
+
* (30 seconds). Pass `0` to disable timeout. The default value can be
|
2361
|
+
* changed by using the {@link Page.setDefaultTimeout} method.
|
2362
|
+
* @param args - Arguments to pass to `pageFunction`
|
2363
|
+
* @returns A `Promise` which resolves to a JSHandle/ElementHandle of the the
|
2364
|
+
* `pageFunction`'s return value.
|
2488
2365
|
*/
|
2489
2366
|
waitForFunction(pageFunction, options = {}, ...args) {
|
2490
2367
|
return this.mainFrame().waitForFunction(pageFunction, options, ...args);
|
2491
2368
|
}
|
2492
2369
|
}
|
2493
2370
|
exports.Page = Page;
|
2371
|
+
_Page_closed = new WeakMap(), _Page_client = new WeakMap(), _Page_target = new WeakMap(), _Page_keyboard = new WeakMap(), _Page_mouse = new WeakMap(), _Page_timeoutSettings = new WeakMap(), _Page_touchscreen = new WeakMap(), _Page_accessibility = new WeakMap(), _Page_frameManager = new WeakMap(), _Page_emulationManager = new WeakMap(), _Page_tracing = new WeakMap(), _Page_pageBindings = new WeakMap(), _Page_coverage = new WeakMap(), _Page_javascriptEnabled = new WeakMap(), _Page_viewport = new WeakMap(), _Page_screenshotTaskQueue = new WeakMap(), _Page_workers = new WeakMap(), _Page_fileChooserInterceptors = new WeakMap(), _Page_disconnectPromise = new WeakMap(), _Page_userDragInterceptionEnabled = new WeakMap(), _Page_handlerMap = new WeakMap(), _Page_instances = new WeakSet(), _Page_initialize = async function _Page_initialize() {
|
2372
|
+
await Promise.all([
|
2373
|
+
__classPrivateFieldGet(this, _Page_frameManager, "f").initialize(),
|
2374
|
+
__classPrivateFieldGet(this, _Page_client, "f").send('Target.setAutoAttach', {
|
2375
|
+
autoAttach: true,
|
2376
|
+
waitForDebuggerOnStart: false,
|
2377
|
+
flatten: true,
|
2378
|
+
}),
|
2379
|
+
__classPrivateFieldGet(this, _Page_client, "f").send('Performance.enable'),
|
2380
|
+
__classPrivateFieldGet(this, _Page_client, "f").send('Log.enable'),
|
2381
|
+
]);
|
2382
|
+
}, _Page_onFileChooser = async function _Page_onFileChooser(event) {
|
2383
|
+
if (!__classPrivateFieldGet(this, _Page_fileChooserInterceptors, "f").size) {
|
2384
|
+
return;
|
2385
|
+
}
|
2386
|
+
const frame = __classPrivateFieldGet(this, _Page_frameManager, "f").frame(event.frameId);
|
2387
|
+
(0, assert_js_1.assert)(frame);
|
2388
|
+
const context = await frame.executionContext();
|
2389
|
+
const element = await context._adoptBackendNodeId(event.backendNodeId);
|
2390
|
+
const interceptors = Array.from(__classPrivateFieldGet(this, _Page_fileChooserInterceptors, "f"));
|
2391
|
+
__classPrivateFieldGet(this, _Page_fileChooserInterceptors, "f").clear();
|
2392
|
+
const fileChooser = new FileChooser_js_1.FileChooser(
|
2393
|
+
// This is guaranteed by the event.
|
2394
|
+
element, event);
|
2395
|
+
for (const interceptor of interceptors) {
|
2396
|
+
interceptor.call(undefined, fileChooser);
|
2397
|
+
}
|
2398
|
+
}, _Page_onTargetCrashed = function _Page_onTargetCrashed() {
|
2399
|
+
this.emit('error', new Error('Page crashed!'));
|
2400
|
+
}, _Page_onLogEntryAdded = function _Page_onLogEntryAdded(event) {
|
2401
|
+
const { level, text, args, source, url, lineNumber } = event.entry;
|
2402
|
+
if (args) {
|
2403
|
+
args.map(arg => {
|
2404
|
+
return (0, util_js_1.releaseObject)(__classPrivateFieldGet(this, _Page_client, "f"), arg);
|
2405
|
+
});
|
2406
|
+
}
|
2407
|
+
if (source !== 'worker') {
|
2408
|
+
this.emit("console" /* PageEmittedEvents.Console */, new ConsoleMessage_js_1.ConsoleMessage(level, text, [], [{ url, lineNumber }]));
|
2409
|
+
}
|
2410
|
+
}, _Page_emitMetrics = function _Page_emitMetrics(event) {
|
2411
|
+
this.emit("metrics" /* PageEmittedEvents.Metrics */, {
|
2412
|
+
title: event.title,
|
2413
|
+
metrics: __classPrivateFieldGet(this, _Page_instances, "m", _Page_buildMetricsObject).call(this, event.metrics),
|
2414
|
+
});
|
2415
|
+
}, _Page_buildMetricsObject = function _Page_buildMetricsObject(metrics) {
|
2416
|
+
const result = {};
|
2417
|
+
for (const metric of metrics || []) {
|
2418
|
+
if (supportedMetrics.has(metric.name)) {
|
2419
|
+
result[metric.name] = metric.value;
|
2420
|
+
}
|
2421
|
+
}
|
2422
|
+
return result;
|
2423
|
+
}, _Page_handleException = function _Page_handleException(exceptionDetails) {
|
2424
|
+
const message = (0, util_js_1.getExceptionMessage)(exceptionDetails);
|
2425
|
+
const err = new Error(message);
|
2426
|
+
err.stack = ''; // Don't report clientside error with a node stack attached
|
2427
|
+
this.emit("pageerror" /* PageEmittedEvents.PageError */, err);
|
2428
|
+
}, _Page_onConsoleAPI = async function _Page_onConsoleAPI(event) {
|
2429
|
+
if (event.executionContextId === 0) {
|
2430
|
+
// DevTools protocol stores the last 1000 console messages. These
|
2431
|
+
// messages are always reported even for removed execution contexts. In
|
2432
|
+
// this case, they are marked with executionContextId = 0 and are
|
2433
|
+
// reported upon enabling Runtime agent.
|
2434
|
+
//
|
2435
|
+
// Ignore these messages since:
|
2436
|
+
// - there's no execution context we can use to operate with message
|
2437
|
+
// arguments
|
2438
|
+
// - these messages are reported before Puppeteer clients can subscribe
|
2439
|
+
// to the 'console'
|
2440
|
+
// page event.
|
2441
|
+
//
|
2442
|
+
// @see https://github.com/puppeteer/puppeteer/issues/3865
|
2443
|
+
return;
|
2444
|
+
}
|
2445
|
+
const context = __classPrivateFieldGet(this, _Page_frameManager, "f").executionContextById(event.executionContextId, __classPrivateFieldGet(this, _Page_client, "f"));
|
2446
|
+
const values = event.args.map(arg => {
|
2447
|
+
return (0, util_js_1.createJSHandle)(context, arg);
|
2448
|
+
});
|
2449
|
+
__classPrivateFieldGet(this, _Page_instances, "m", _Page_addConsoleMessage).call(this, event.type, values, event.stackTrace);
|
2450
|
+
}, _Page_onBindingCalled = async function _Page_onBindingCalled(event) {
|
2451
|
+
let payload;
|
2452
|
+
try {
|
2453
|
+
payload = JSON.parse(event.payload);
|
2454
|
+
}
|
2455
|
+
catch {
|
2456
|
+
// The binding was either called by something in the page or it was
|
2457
|
+
// called before our wrapper was initialized.
|
2458
|
+
return;
|
2459
|
+
}
|
2460
|
+
const { type, name, seq, args } = payload;
|
2461
|
+
if (type !== 'exposedFun' || !__classPrivateFieldGet(this, _Page_pageBindings, "f").has(name)) {
|
2462
|
+
return;
|
2463
|
+
}
|
2464
|
+
let expression = null;
|
2465
|
+
try {
|
2466
|
+
const pageBinding = __classPrivateFieldGet(this, _Page_pageBindings, "f").get(name);
|
2467
|
+
(0, assert_js_1.assert)(pageBinding);
|
2468
|
+
const result = await pageBinding(...args);
|
2469
|
+
expression = (0, util_js_1.pageBindingDeliverResultString)(name, seq, result);
|
2470
|
+
}
|
2471
|
+
catch (error) {
|
2472
|
+
if ((0, util_js_1.isErrorLike)(error)) {
|
2473
|
+
expression = (0, util_js_1.pageBindingDeliverErrorString)(name, seq, error.message, error.stack);
|
2474
|
+
}
|
2475
|
+
else {
|
2476
|
+
expression = (0, util_js_1.pageBindingDeliverErrorValueString)(name, seq, error);
|
2477
|
+
}
|
2478
|
+
}
|
2479
|
+
__classPrivateFieldGet(this, _Page_client, "f")
|
2480
|
+
.send('Runtime.evaluate', {
|
2481
|
+
expression,
|
2482
|
+
contextId: event.executionContextId,
|
2483
|
+
})
|
2484
|
+
.catch(util_js_1.debugError);
|
2485
|
+
}, _Page_addConsoleMessage = function _Page_addConsoleMessage(eventType, args, stackTrace) {
|
2486
|
+
if (!this.listenerCount("console" /* PageEmittedEvents.Console */)) {
|
2487
|
+
args.forEach(arg => {
|
2488
|
+
return arg.dispose();
|
2489
|
+
});
|
2490
|
+
return;
|
2491
|
+
}
|
2492
|
+
const textTokens = [];
|
2493
|
+
for (const arg of args) {
|
2494
|
+
const remoteObject = arg._remoteObject;
|
2495
|
+
if (remoteObject.objectId) {
|
2496
|
+
textTokens.push(arg.toString());
|
2497
|
+
}
|
2498
|
+
else {
|
2499
|
+
textTokens.push((0, util_js_1.valueFromRemoteObject)(remoteObject));
|
2500
|
+
}
|
2501
|
+
}
|
2502
|
+
const stackTraceLocations = [];
|
2503
|
+
if (stackTrace) {
|
2504
|
+
for (const callFrame of stackTrace.callFrames) {
|
2505
|
+
stackTraceLocations.push({
|
2506
|
+
url: callFrame.url,
|
2507
|
+
lineNumber: callFrame.lineNumber,
|
2508
|
+
columnNumber: callFrame.columnNumber,
|
2509
|
+
});
|
2510
|
+
}
|
2511
|
+
}
|
2512
|
+
const message = new ConsoleMessage_js_1.ConsoleMessage(eventType, textTokens.join(' '), args, stackTraceLocations);
|
2513
|
+
this.emit("console" /* PageEmittedEvents.Console */, message);
|
2514
|
+
}, _Page_onDialog = function _Page_onDialog(event) {
|
2515
|
+
let dialogType = null;
|
2516
|
+
const validDialogTypes = new Set([
|
2517
|
+
'alert',
|
2518
|
+
'confirm',
|
2519
|
+
'prompt',
|
2520
|
+
'beforeunload',
|
2521
|
+
]);
|
2522
|
+
if (validDialogTypes.has(event.type)) {
|
2523
|
+
dialogType = event.type;
|
2524
|
+
}
|
2525
|
+
(0, assert_js_1.assert)(dialogType, 'Unknown javascript dialog type: ' + event.type);
|
2526
|
+
const dialog = new Dialog_js_1.Dialog(__classPrivateFieldGet(this, _Page_client, "f"), dialogType, event.message, event.defaultPrompt);
|
2527
|
+
this.emit("dialog" /* PageEmittedEvents.Dialog */, dialog);
|
2528
|
+
}, _Page_resetDefaultBackgroundColor =
|
2529
|
+
/**
|
2530
|
+
* Resets default white background
|
2531
|
+
*/
|
2532
|
+
async function _Page_resetDefaultBackgroundColor() {
|
2533
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setDefaultBackgroundColorOverride');
|
2534
|
+
}, _Page_setTransparentBackgroundColor =
|
2535
|
+
/**
|
2536
|
+
* Hides default white background
|
2537
|
+
*/
|
2538
|
+
async function _Page_setTransparentBackgroundColor() {
|
2539
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setDefaultBackgroundColorOverride', {
|
2540
|
+
color: { r: 0, g: 0, b: 0, a: 0 },
|
2541
|
+
});
|
2542
|
+
}, _Page_sessionClosePromise = function _Page_sessionClosePromise() {
|
2543
|
+
if (!__classPrivateFieldGet(this, _Page_disconnectPromise, "f")) {
|
2544
|
+
__classPrivateFieldSet(this, _Page_disconnectPromise, new Promise(fulfill => {
|
2545
|
+
return __classPrivateFieldGet(this, _Page_client, "f").once(Connection_js_1.CDPSessionEmittedEvents.Disconnected, () => {
|
2546
|
+
return fulfill(new Error('Target closed'));
|
2547
|
+
});
|
2548
|
+
}), "f");
|
2549
|
+
}
|
2550
|
+
return __classPrivateFieldGet(this, _Page_disconnectPromise, "f");
|
2551
|
+
}, _Page_go = async function _Page_go(delta, options) {
|
2552
|
+
const history = await __classPrivateFieldGet(this, _Page_client, "f").send('Page.getNavigationHistory');
|
2553
|
+
const entry = history.entries[history.currentIndex + delta];
|
2554
|
+
if (!entry) {
|
2555
|
+
return null;
|
2556
|
+
}
|
2557
|
+
const result = await Promise.all([
|
2558
|
+
this.waitForNavigation(options),
|
2559
|
+
__classPrivateFieldGet(this, _Page_client, "f").send('Page.navigateToHistoryEntry', { entryId: entry.id }),
|
2560
|
+
]);
|
2561
|
+
return result[0];
|
2562
|
+
}, _Page_screenshotTask = async function _Page_screenshotTask(format, options = {}) {
|
2563
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Target.activateTarget', {
|
2564
|
+
targetId: __classPrivateFieldGet(this, _Page_target, "f")._targetId,
|
2565
|
+
});
|
2566
|
+
let clip = options.clip ? processClip(options.clip) : undefined;
|
2567
|
+
const captureBeyondViewport = typeof options.captureBeyondViewport === 'boolean'
|
2568
|
+
? options.captureBeyondViewport
|
2569
|
+
: true;
|
2570
|
+
const fromSurface = typeof options.fromSurface === 'boolean'
|
2571
|
+
? options.fromSurface
|
2572
|
+
: undefined;
|
2573
|
+
if (options.fullPage) {
|
2574
|
+
const metrics = await __classPrivateFieldGet(this, _Page_client, "f").send('Page.getLayoutMetrics');
|
2575
|
+
// Fallback to `contentSize` in case of using Firefox.
|
2576
|
+
const { width, height } = metrics.cssContentSize || metrics.contentSize;
|
2577
|
+
// Overwrite clip for full page.
|
2578
|
+
clip = { x: 0, y: 0, width, height, scale: 1 };
|
2579
|
+
if (!captureBeyondViewport) {
|
2580
|
+
const { isMobile = false, deviceScaleFactor = 1, isLandscape = false, } = __classPrivateFieldGet(this, _Page_viewport, "f") || {};
|
2581
|
+
const screenOrientation = isLandscape
|
2582
|
+
? { angle: 90, type: 'landscapePrimary' }
|
2583
|
+
: { angle: 0, type: 'portraitPrimary' };
|
2584
|
+
await __classPrivateFieldGet(this, _Page_client, "f").send('Emulation.setDeviceMetricsOverride', {
|
2585
|
+
mobile: isMobile,
|
2586
|
+
width,
|
2587
|
+
height,
|
2588
|
+
deviceScaleFactor,
|
2589
|
+
screenOrientation,
|
2590
|
+
});
|
2591
|
+
}
|
2592
|
+
}
|
2593
|
+
const shouldSetDefaultBackground = options.omitBackground && (format === 'png' || format === 'webp');
|
2594
|
+
if (shouldSetDefaultBackground) {
|
2595
|
+
await __classPrivateFieldGet(this, _Page_instances, "m", _Page_setTransparentBackgroundColor).call(this);
|
2596
|
+
}
|
2597
|
+
const result = await __classPrivateFieldGet(this, _Page_client, "f").send('Page.captureScreenshot', {
|
2598
|
+
format,
|
2599
|
+
quality: options.quality,
|
2600
|
+
clip,
|
2601
|
+
captureBeyondViewport,
|
2602
|
+
fromSurface,
|
2603
|
+
});
|
2604
|
+
if (shouldSetDefaultBackground) {
|
2605
|
+
await __classPrivateFieldGet(this, _Page_instances, "m", _Page_resetDefaultBackgroundColor).call(this);
|
2606
|
+
}
|
2607
|
+
if (options.fullPage && __classPrivateFieldGet(this, _Page_viewport, "f")) {
|
2608
|
+
await this.setViewport(__classPrivateFieldGet(this, _Page_viewport, "f"));
|
2609
|
+
}
|
2610
|
+
const buffer = options.encoding === 'base64'
|
2611
|
+
? result.data
|
2612
|
+
: Buffer.from(result.data, 'base64');
|
2613
|
+
if (options.path) {
|
2614
|
+
try {
|
2615
|
+
const fs = (await Promise.resolve().then(() => __importStar(require('fs')))).promises;
|
2616
|
+
await fs.writeFile(options.path, buffer);
|
2617
|
+
}
|
2618
|
+
catch (error) {
|
2619
|
+
if (error instanceof TypeError) {
|
2620
|
+
throw new Error('Screenshots can only be written to a file path in a Node-like environment.');
|
2621
|
+
}
|
2622
|
+
throw error;
|
2623
|
+
}
|
2624
|
+
}
|
2625
|
+
return buffer;
|
2626
|
+
function processClip(clip) {
|
2627
|
+
const x = Math.round(clip.x);
|
2628
|
+
const y = Math.round(clip.y);
|
2629
|
+
const width = Math.round(clip.width + clip.x - x);
|
2630
|
+
const height = Math.round(clip.height + clip.y - y);
|
2631
|
+
return { x, y, width, height, scale: 1 };
|
2632
|
+
}
|
2633
|
+
};
|
2494
2634
|
const supportedMetrics = new Set([
|
2495
2635
|
'Timestamp',
|
2496
2636
|
'Documents',
|
@@ -2513,18 +2653,19 @@ const unitToPixels = {
|
|
2513
2653
|
mm: 3.78,
|
2514
2654
|
};
|
2515
2655
|
function convertPrintParameterToInches(parameter) {
|
2516
|
-
if (typeof parameter === 'undefined')
|
2656
|
+
if (typeof parameter === 'undefined') {
|
2517
2657
|
return undefined;
|
2658
|
+
}
|
2518
2659
|
let pixels;
|
2519
|
-
if (
|
2660
|
+
if ((0, util_js_1.isNumber)(parameter)) {
|
2520
2661
|
// Treat numbers as pixel values to be aligned with phantom's paperSize.
|
2521
|
-
pixels =
|
2662
|
+
pixels = parameter;
|
2522
2663
|
}
|
2523
|
-
else if (
|
2524
|
-
const text =
|
2664
|
+
else if ((0, util_js_1.isString)(parameter)) {
|
2665
|
+
const text = parameter;
|
2525
2666
|
let unit = text.substring(text.length - 2).toLowerCase();
|
2526
2667
|
let valueText = '';
|
2527
|
-
if (unitToPixels
|
2668
|
+
if (unit in unitToPixels) {
|
2528
2669
|
valueText = text.substring(0, text.length - 2);
|
2529
2670
|
}
|
2530
2671
|
else {
|