chrome-devtools-frontend 1.0.1037221 → 1.0.1039140
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/config/gni/devtools_grd_files.gni +9 -2
- package/front_end/core/common/ParsedURL.ts +1 -1
- package/front_end/core/i18n/locales/en-US.json +2 -2
- package/front_end/core/i18n/locales/en-XL.json +2 -2
- package/front_end/core/sdk/ResourceTreeModel.ts +12 -8
- package/front_end/panels/sources/NavigatorView.ts +9 -0
- package/front_end/services/puppeteer/PuppeteerConnection.ts +1 -1
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +244 -244
- package/front_end/third_party/lighthouse/locales/en-US.json +2 -2
- package/front_end/third_party/lighthouse/locales/en-XL.json +2 -2
- package/front_end/third_party/puppeteer/package/README.md +20 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Accessibility.js +4 -4
- 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 +10 -8
- 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 +19 -6
- 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 +23 -10
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +3 -2
- 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/ChromeTargetManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ChromeTargetManager.js +35 -20
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ChromeTargetManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +9 -2
- 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 +19 -7
- 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/Coverage.d.ts +5 -4
- 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 +6 -5
- 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/Debug.d.ts +1 -0
- 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 +1 -0
- 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/Dialog.d.ts +2 -0
- 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 +3 -1
- 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 +168 -131
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.js +208 -206
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +1 -0
- 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 +1 -0
- 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 +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts +74 -75
- 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 +82 -97
- 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 +16 -8
- 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 +17 -9
- 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/FirefoxTargetManager.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FirefoxTargetManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FirefoxTargetManager.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FirefoxTargetManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Frame.d.ts +634 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Frame.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Frame.js +713 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Frame.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +9 -679
- 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 +77 -803
- 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 +11 -10
- 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 +11 -10
- 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 +2 -2
- 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 +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Input.d.ts +34 -13
- 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 +35 -14
- 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/{DOMWorld.d.ts → IsolatedWorld.d.ts} +58 -13
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/IsolatedWorld.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/{DOMWorld.js → IsolatedWorld.js} +124 -151
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/IsolatedWorld.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.d.ts +40 -58
- 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 +53 -76
- 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 +2 -1
- 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 +23 -6
- 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/NetworkEventManager.js +17 -17
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/NetworkManager.d.ts +1 -1
- 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 +8 -8
- 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 +2 -0
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.d.ts +395 -296
- 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 +398 -313
- 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 +14 -7
- 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 +14 -7
- 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 -17
- 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 +49 -31
- 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/Target.d.ts +1 -1
- 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 +7 -3
- 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/Tracing.d.ts +1 -0
- 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 +4 -2
- 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/WebWorker.d.ts +8 -4
- 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 +8 -4
- 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/util.d.ts +1 -34
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js +5 -53
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +6 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initializePuppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initializePuppeteer.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initializePuppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/Poller.d.ts +28 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/Poller.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/Poller.js +148 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/Poller.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.js +18 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserFetcher.d.ts +3 -1
- 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 +4 -2
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js +4 -3
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/FirefoxLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/PipeTransport.js +1 -1
- 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/Puppeteer.d.ts +3 -1
- 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 +3 -1
- 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/types.d.ts +3 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/types.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/types.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/types.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/DeferredPromise.d.ts +25 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/DeferredPromise.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/DeferredPromise.js +78 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/DeferredPromise.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/ErrorLike.d.ts +17 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/ErrorLike.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/ErrorLike.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/ErrorLike.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/{common → util}/assert.d.ts +0 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/assert.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/{common → util}/assert.js +0 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/assert.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/getPackageDirectory.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/getPackageDirectory.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/getPackageDirectory.js +19 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/getPackageDirectory.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Accessibility.js +4 -4
- 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 +10 -8
- 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 +19 -6
- 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 +23 -10
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +3 -2
- 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/ChromeTargetManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ChromeTargetManager.js +36 -21
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ChromeTargetManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts +9 -2
- 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 +19 -7
- 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/Coverage.d.ts +5 -4
- 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 +6 -5
- 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/Debug.d.ts +1 -0
- 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 +1 -0
- 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/Dialog.d.ts +2 -0
- 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 +3 -1
- 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 +168 -131
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.js +208 -206
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ElementHandle.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +1 -0
- 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 +1 -0
- 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 +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts +74 -75
- 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 +83 -98
- 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 +16 -8
- 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 +17 -9
- 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/FirefoxTargetManager.d.ts +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FirefoxTargetManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FirefoxTargetManager.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FirefoxTargetManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Frame.d.ts +634 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Frame.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Frame.js +709 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Frame.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +9 -679
- 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 +72 -797
- 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 +11 -10
- 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 +11 -10
- 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 +2 -2
- 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 +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Input.d.ts +34 -13
- 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 +35 -14
- 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/{DOMWorld.d.ts → IsolatedWorld.d.ts} +58 -13
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/IsolatedWorld.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/{DOMWorld.js → IsolatedWorld.js} +123 -150
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/IsolatedWorld.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.d.ts +40 -58
- 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 +54 -77
- 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 +2 -1
- 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 +24 -7
- 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/NetworkEventManager.js +17 -17
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/NetworkManager.d.ts +1 -1
- 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 +8 -8
- 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 +2 -0
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.d.ts +395 -296
- 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 +398 -313
- 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 +14 -7
- 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 +14 -7
- 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 -17
- 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 +49 -31
- 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/Target.d.ts +1 -1
- 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 +7 -3
- 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/Tracing.d.ts +1 -0
- 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 +4 -2
- 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/WebWorker.d.ts +8 -4
- 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 +8 -4
- 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/util.d.ts +1 -34
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js +3 -48
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/util.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initializePuppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initializePuppeteer.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initializePuppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/Poller.d.ts +28 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/Poller.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/Poller.js +142 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/Poller.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/injected.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/injected.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/injected.js +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/injected/injected.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserFetcher.d.ts +3 -1
- 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 +4 -2
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js +3 -2
- 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.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/FirefoxLauncher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/FirefoxLauncher.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/FirefoxLauncher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/PipeTransport.js +1 -1
- 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/Puppeteer.d.ts +3 -1
- 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 +3 -1
- 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/types.d.ts +3 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.js +3 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/types.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/DeferredPromise.d.ts +25 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/DeferredPromise.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/DeferredPromise.js +73 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/DeferredPromise.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/ErrorLike.d.ts +17 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/ErrorLike.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/ErrorLike.js +17 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/ErrorLike.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/{common → util}/assert.d.ts +0 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/assert.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/{common → util}/assert.js +0 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/assert.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/getPackageDirectory.d.ts +2 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/getPackageDirectory.d.ts.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/getPackageDirectory.js +15 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/getPackageDirectory.js.map +1 -0
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +1069 -878
- package/front_end/third_party/puppeteer/package/package.json +32 -28
- package/front_end/third_party/puppeteer/package/typescript-if-required.js +1 -1
- package/front_end/third_party/puppeteer/puppeteer.ts +1 -1
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryHighlightChipList.ts +16 -6
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryInspector.ts +28 -4
- package/front_end/ui/components/linear_memory_inspector/LinearMemoryViewer.ts +15 -0
- package/front_end/ui/components/linear_memory_inspector/linearMemoryHighlightChipList.css +27 -12
- package/front_end/ui/components/linear_memory_inspector/linearMemoryViewer.css +19 -4
- package/package.json +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/assert.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.d.ts.map +0 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/assert.js.map +0 -1
@@ -45,6 +45,7 @@ export declare class Accessibility {
|
|
45
45
|
*
|
46
46
|
* @example
|
47
47
|
* An example of dumping the entire accessibility tree:
|
48
|
+
*
|
48
49
|
* ```ts
|
49
50
|
* const snapshot = await page.accessibility.snapshot();
|
50
51
|
* console.log(snapshot);
|
@@ -52,14 +53,14 @@ export declare class Accessibility {
|
|
52
53
|
*
|
53
54
|
* @example
|
54
55
|
* An example of logging the focused node's name:
|
56
|
+
*
|
55
57
|
* ```ts
|
56
58
|
* const snapshot = await page.accessibility.snapshot();
|
57
59
|
* const node = findFocusedNode(snapshot);
|
58
60
|
* console.log(node && node.name);
|
59
61
|
*
|
60
62
|
* function findFocusedNode(node) {
|
61
|
-
* if (node.focused)
|
62
|
-
* return node;
|
63
|
+
* if (node.focused) return node;
|
63
64
|
* for (const child of node.children || []) {
|
64
65
|
* const foundNode = findFocusedNode(child);
|
65
66
|
* return foundNode;
|
@@ -69,7 +70,6 @@ export declare class Accessibility {
|
|
69
70
|
* ```
|
70
71
|
*
|
71
72
|
* @returns An AXNode object representing the snapshot.
|
72
|
-
*
|
73
73
|
*/
|
74
74
|
snapshot(options?: SnapshotOptions): Promise<SerializedAXNode | null>;
|
75
75
|
private serializeTree;
|
@@ -85,8 +85,6 @@ export declare type ActionResult = 'continue' | 'abort' | 'respond';
|
|
85
85
|
|
86
86
|
/* Excluded from this release type: ariaHandler */
|
87
87
|
|
88
|
-
/* Excluded from this release type: assert */
|
89
|
-
|
90
88
|
/**
|
91
89
|
* @public
|
92
90
|
*/
|
@@ -128,8 +126,8 @@ export declare interface BoxModel {
|
|
128
126
|
* emit various events which are documented in the {@link BrowserEmittedEvents} enum.
|
129
127
|
*
|
130
128
|
* @example
|
131
|
-
*
|
132
129
|
* An example of using a {@link Browser} to create a {@link Page}:
|
130
|
+
*
|
133
131
|
* ```ts
|
134
132
|
* const puppeteer = require('puppeteer');
|
135
133
|
*
|
@@ -142,8 +140,8 @@ export declare interface BoxModel {
|
|
142
140
|
* ```
|
143
141
|
*
|
144
142
|
* @example
|
145
|
-
*
|
146
143
|
* An example of disconnecting from and reconnecting to a {@link Browser}:
|
144
|
+
*
|
147
145
|
* ```ts
|
148
146
|
* const puppeteer = require('puppeteer');
|
149
147
|
*
|
@@ -182,9 +180,10 @@ export declare class Browser extends EventEmitter {
|
|
182
180
|
* browser contexts.
|
183
181
|
*
|
184
182
|
* @example
|
183
|
+
*
|
185
184
|
* ```ts
|
186
185
|
* (async () => {
|
187
|
-
*
|
186
|
+
* const browser = await puppeteer.launch();
|
188
187
|
* // Create a new incognito browser context.
|
189
188
|
* const context = await browser.createIncognitoBrowserContext();
|
190
189
|
* // Create a new page in a pristine context.
|
@@ -247,9 +246,12 @@ export declare class Browser extends EventEmitter {
|
|
247
246
|
* @example
|
248
247
|
*
|
249
248
|
* An example of finding a target for a page opened via `window.open`:
|
249
|
+
*
|
250
250
|
* ```ts
|
251
251
|
* await page.evaluate(() => window.open('https://www.example.com/'));
|
252
|
-
* const newWindowTarget = await browser.waitForTarget(
|
252
|
+
* const newWindowTarget = await browser.waitForTarget(
|
253
|
+
* target => target.url() === 'https://www.example.com/'
|
254
|
+
* );
|
253
255
|
* ```
|
254
256
|
*/
|
255
257
|
waitForTarget(predicate: (x: Target) => boolean | Promise<boolean>, options?: WaitForTargetOptions): Promise<Target>;
|
@@ -345,6 +347,7 @@ export declare interface BrowserConnectOptions {
|
|
345
347
|
* method. "Incognito" browser contexts don't write any browsing data to disk.
|
346
348
|
*
|
347
349
|
* @example
|
350
|
+
*
|
348
351
|
* ```ts
|
349
352
|
* // Create a new incognito browser context
|
350
353
|
* const context = await browser.createIncognitoBrowserContext();
|
@@ -355,6 +358,7 @@ export declare interface BrowserConnectOptions {
|
|
355
358
|
* // Dispose context once it's no longer needed.
|
356
359
|
* await context.close();
|
357
360
|
* ```
|
361
|
+
*
|
358
362
|
* @public
|
359
363
|
*/
|
360
364
|
export declare class BrowserContext extends EventEmitter {
|
@@ -369,9 +373,12 @@ export declare class BrowserContext extends EventEmitter {
|
|
369
373
|
*
|
370
374
|
* @example
|
371
375
|
* An example of finding a target for a page opened via `window.open`:
|
376
|
+
*
|
372
377
|
* ```ts
|
373
378
|
* await page.evaluate(() => window.open('https://www.example.com/'));
|
374
|
-
* const newWindowTarget = await browserContext.waitForTarget(
|
379
|
+
* const newWindowTarget = await browserContext.waitForTarget(
|
380
|
+
* target => target.url() === 'https://www.example.com/'
|
381
|
+
* );
|
375
382
|
* ```
|
376
383
|
*
|
377
384
|
* @param predicate - A function to be run for every target
|
@@ -402,9 +409,12 @@ export declare class BrowserContext extends EventEmitter {
|
|
402
409
|
isIncognito(): boolean;
|
403
410
|
/**
|
404
411
|
* @example
|
412
|
+
*
|
405
413
|
* ```ts
|
406
414
|
* const context = browser.defaultBrowserContext();
|
407
|
-
* await context.overridePermissions('https://html5demos.com', [
|
415
|
+
* await context.overridePermissions('https://html5demos.com', [
|
416
|
+
* 'geolocation',
|
417
|
+
* ]);
|
408
418
|
* ```
|
409
419
|
*
|
410
420
|
* @param origin - The origin to grant permissions to, e.g. "https://example.com".
|
@@ -416,6 +426,7 @@ export declare class BrowserContext extends EventEmitter {
|
|
416
426
|
* Clears all permission overrides for the browser context.
|
417
427
|
*
|
418
428
|
* @example
|
429
|
+
*
|
419
430
|
* ```ts
|
420
431
|
* const context = browser.defaultBrowserContext();
|
421
432
|
* context.overridePermissions('https://example.com', ['clipboard-read']);
|
@@ -545,7 +556,9 @@ export declare const enum BrowserEmittedEvents {
|
|
545
556
|
* ```ts
|
546
557
|
* const browserFetcher = puppeteer.createBrowserFetcher();
|
547
558
|
* const revisionInfo = await browserFetcher.download('533271');
|
548
|
-
* const browser = await puppeteer.launch({
|
559
|
+
* const browser = await puppeteer.launch({
|
560
|
+
* executablePath: revisionInfo.executablePath,
|
561
|
+
* });
|
549
562
|
* ```
|
550
563
|
*
|
551
564
|
* **NOTE** BrowserFetcher is not designed to work concurrently with other
|
@@ -683,14 +696,17 @@ export declare interface BrowserLaunchArgumentOptions {
|
|
683
696
|
* and {@link https://github.com/aslushnikov/getting-started-with-cdp/blob/HEAD/README.md | Getting Started with DevTools Protocol}.
|
684
697
|
*
|
685
698
|
* @example
|
699
|
+
*
|
686
700
|
* ```ts
|
687
701
|
* const client = await page.target().createCDPSession();
|
688
702
|
* await client.send('Animation.enable');
|
689
|
-
* client.on('Animation.animationCreated', () =>
|
703
|
+
* client.on('Animation.animationCreated', () =>
|
704
|
+
* console.log('Animation created!')
|
705
|
+
* );
|
690
706
|
* const response = await client.send('Animation.getPlaybackRate');
|
691
707
|
* console.log('playback rate is ' + response.playbackRate);
|
692
708
|
* await client.send('Animation.setPlaybackRate', {
|
693
|
-
* playbackRate: response.playbackRate / 2
|
709
|
+
* playbackRate: response.playbackRate / 2,
|
694
710
|
* });
|
695
711
|
* ```
|
696
712
|
*
|
@@ -821,6 +837,7 @@ export declare class Connection extends EventEmitter {
|
|
821
837
|
/* Excluded from this release type: onMessage */
|
822
838
|
dispose(): void;
|
823
839
|
/* Excluded from this release type: isAutoAttached */
|
840
|
+
/* Excluded from this release type: _createSession */
|
824
841
|
/**
|
825
842
|
* @param targetInfo - The target info
|
826
843
|
* @returns The CDP session that is created
|
@@ -958,11 +975,12 @@ export declare interface ContinueRequestOverrides {
|
|
958
975
|
* @example
|
959
976
|
* An example of using JavaScript and CSS coverage to get percentage of initially
|
960
977
|
* executed code:
|
978
|
+
*
|
961
979
|
* ```ts
|
962
980
|
* // Enable both JavaScript and CSS coverage
|
963
981
|
* await Promise.all([
|
964
982
|
* page.coverage.startJSCoverage(),
|
965
|
-
* page.coverage.startCSSCoverage()
|
983
|
+
* page.coverage.startCSSCoverage(),
|
966
984
|
* ]);
|
967
985
|
* // Navigate to page
|
968
986
|
* await page.goto('https://example.com');
|
@@ -976,11 +994,11 @@ export declare interface ContinueRequestOverrides {
|
|
976
994
|
* const coverage = [...jsCoverage, ...cssCoverage];
|
977
995
|
* for (const entry of coverage) {
|
978
996
|
* totalBytes += entry.text.length;
|
979
|
-
* for (const range of entry.ranges)
|
980
|
-
* usedBytes += range.end - range.start - 1;
|
997
|
+
* for (const range of entry.ranges) usedBytes += range.end - range.start - 1;
|
981
998
|
* }
|
982
|
-
* console.log(`Bytes used: ${usedBytes / totalBytes * 100}%`);
|
999
|
+
* console.log(`Bytes used: ${(usedBytes / totalBytes) * 100}%`);
|
983
1000
|
* ```
|
1001
|
+
*
|
984
1002
|
* @public
|
985
1003
|
*/
|
986
1004
|
export declare class Coverage {
|
@@ -1047,8 +1065,6 @@ export declare interface CoverageEntry {
|
|
1047
1065
|
|
1048
1066
|
export declare const createBrowserFetcher: (options: BrowserFetcherOptions) => BrowserFetcher;
|
1049
1067
|
|
1050
|
-
/* Excluded from this release type: createDeferredPromiseWithTimer */
|
1051
|
-
|
1052
1068
|
/* Excluded from this release type: createJSHandle */
|
1053
1069
|
|
1054
1070
|
/* Excluded from this release type: createLauncher */
|
@@ -1107,19 +1123,17 @@ export declare class CustomError extends Error {
|
|
1107
1123
|
}
|
1108
1124
|
|
1109
1125
|
/**
|
1110
|
-
* Contains two functions `queryOne` and `queryAll` that can
|
1111
|
-
* be {@link registerCustomQueryHandler | registered}
|
1112
|
-
* as alternative querying strategies. The functions `queryOne` and `queryAll`
|
1113
|
-
* are executed in the page context. `queryOne` should take an `Element` and a
|
1114
|
-
* selector string as argument and return a single `Element` or `null` if no
|
1115
|
-
* element is found. `queryAll` takes the same arguments but should instead
|
1116
|
-
* return a `NodeListOf<Element>` or `Array<Element>` with all the elements
|
1117
|
-
* that match the given query selector.
|
1118
1126
|
* @public
|
1119
1127
|
*/
|
1120
1128
|
export declare interface CustomQueryHandler {
|
1121
|
-
|
1122
|
-
|
1129
|
+
/**
|
1130
|
+
* @returns A {@link Node} matching the given `selector` from {@link node}.
|
1131
|
+
*/
|
1132
|
+
queryOne?: (node: Node, selector: string) => Node | null;
|
1133
|
+
/**
|
1134
|
+
* @returns Some {@link Node}s matching the given `selector` from {@link node}.
|
1135
|
+
*/
|
1136
|
+
queryAll?: (node: Node, selector: string) => Node[];
|
1123
1137
|
}
|
1124
1138
|
|
1125
1139
|
/**
|
@@ -1142,8 +1156,6 @@ export declare const DEFAULT_INTERCEPT_RESOLUTION_PRIORITY = 0;
|
|
1142
1156
|
|
1143
1157
|
export declare const defaultArgs: (options?: BrowserLaunchArgumentOptions) => string[];
|
1144
1158
|
|
1145
|
-
/* Excluded from this release type: DeferredPromise */
|
1146
|
-
|
1147
1159
|
/**
|
1148
1160
|
* Copyright 2017 Google Inc. All rights reserved.
|
1149
1161
|
*
|
@@ -1211,6 +1223,7 @@ export declare type DevicesMap = {
|
|
1211
1223
|
* @remarks
|
1212
1224
|
*
|
1213
1225
|
* @example
|
1226
|
+
*
|
1214
1227
|
* ```ts
|
1215
1228
|
* const puppeteer = require('puppeteer');
|
1216
1229
|
*
|
@@ -1225,6 +1238,7 @@ export declare type DevicesMap = {
|
|
1225
1238
|
* page.evaluate(() => alert('1'));
|
1226
1239
|
* })();
|
1227
1240
|
* ```
|
1241
|
+
*
|
1228
1242
|
* @public
|
1229
1243
|
*/
|
1230
1244
|
export declare class Dialog {
|
@@ -1256,8 +1270,6 @@ export declare class Dialog {
|
|
1256
1270
|
dismiss(): Promise<void>;
|
1257
1271
|
}
|
1258
1272
|
|
1259
|
-
/* Excluded from this release type: DOMWorld */
|
1260
|
-
|
1261
1273
|
/* Excluded from this release type: downloadBrowser */
|
1262
1274
|
|
1263
1275
|
/**
|
@@ -1270,12 +1282,12 @@ export declare class Dialog {
|
|
1270
1282
|
* const puppeteer = require('puppeteer');
|
1271
1283
|
*
|
1272
1284
|
* (async () => {
|
1273
|
-
*
|
1274
|
-
*
|
1275
|
-
*
|
1276
|
-
*
|
1277
|
-
*
|
1278
|
-
*
|
1285
|
+
* const browser = await puppeteer.launch();
|
1286
|
+
* const page = await browser.newPage();
|
1287
|
+
* await page.goto('https://example.com');
|
1288
|
+
* const hrefElement = await page.$('a');
|
1289
|
+
* await hrefElement.click();
|
1290
|
+
* // ...
|
1279
1291
|
* })();
|
1280
1292
|
* ```
|
1281
1293
|
*
|
@@ -1297,64 +1309,168 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1297
1309
|
#private;
|
1298
1310
|
/* Excluded from this release type: __constructor */
|
1299
1311
|
/**
|
1300
|
-
*
|
1301
|
-
* method the `selector` already exists, the method will return immediately. If
|
1302
|
-
* the `selector` doesn't appear after the `timeout` milliseconds of waiting, the
|
1303
|
-
* function will throw.
|
1312
|
+
* Queries the current element for an element matching the given selector.
|
1304
1313
|
*
|
1305
|
-
*
|
1314
|
+
* @param selector - The selector to query for.
|
1315
|
+
* @returns A {@link ElementHandle | element handle} to the first element
|
1316
|
+
* matching the given selector. Otherwise, `null`.
|
1317
|
+
*/
|
1318
|
+
$<Selector extends string>(selector: Selector): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
1319
|
+
/**
|
1320
|
+
* Queries the current element for all elements matching the given selector.
|
1306
1321
|
*
|
1307
|
-
* @param selector -
|
1308
|
-
* {@link
|
1309
|
-
*
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
*
|
1314
|
-
*
|
1315
|
-
* The optional parameters in `options` are:
|
1322
|
+
* @param selector - The selector to query for.
|
1323
|
+
* @returns An array of {@link ElementHandle | element handles} that point to
|
1324
|
+
* elements matching the given selector.
|
1325
|
+
*/
|
1326
|
+
$$<Selector extends string>(selector: Selector): Promise<Array<ElementHandle<NodeFor<Selector>>>>;
|
1327
|
+
/**
|
1328
|
+
* Runs the given function on the first element matching the given selector in
|
1329
|
+
* the current element.
|
1316
1330
|
*
|
1317
|
-
*
|
1318
|
-
*
|
1319
|
-
* properties. Defaults to `false`.
|
1331
|
+
* If the given function returns a promise, then this method will wait till
|
1332
|
+
* the promise resolves.
|
1320
1333
|
*
|
1321
|
-
*
|
1322
|
-
*
|
1323
|
-
*
|
1334
|
+
* @example
|
1335
|
+
*
|
1336
|
+
* ```ts
|
1337
|
+
* const tweetHandle = await page.$('.tweet');
|
1338
|
+
* expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe(
|
1339
|
+
* '100'
|
1340
|
+
* );
|
1341
|
+
* expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe(
|
1342
|
+
* '10'
|
1343
|
+
* );
|
1344
|
+
* ```
|
1345
|
+
*
|
1346
|
+
* @param selector - The selector to query for.
|
1347
|
+
* @param pageFunction - The function to be evaluated in this element's page's
|
1348
|
+
* context. The first element matching the selector will be passed in as the
|
1349
|
+
* first argument.
|
1350
|
+
* @param args - Additional arguments to pass to `pageFunction`.
|
1351
|
+
* @returns A promise to the result of the function.
|
1352
|
+
*/
|
1353
|
+
$eval<Selector extends string, Params extends unknown[], Func extends EvaluateFunc<[
|
1354
|
+
ElementHandle<NodeFor<Selector>>,
|
1355
|
+
...Params
|
1356
|
+
]> = EvaluateFunc<[ElementHandle<NodeFor<Selector>>, ...Params]>>(selector: Selector, pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
1357
|
+
/**
|
1358
|
+
* Runs the given function on an array of elements matching the given selector
|
1359
|
+
* in the current element.
|
1360
|
+
*
|
1361
|
+
* If the given function returns a promise, then this method will wait till
|
1362
|
+
* the promise resolves.
|
1363
|
+
*
|
1364
|
+
* @example
|
1365
|
+
* HTML:
|
1366
|
+
*
|
1367
|
+
* ```html
|
1368
|
+
* <div class="feed">
|
1369
|
+
* <div class="tweet">Hello!</div>
|
1370
|
+
* <div class="tweet">Hi!</div>
|
1371
|
+
* </div>
|
1372
|
+
* ```
|
1324
1373
|
*
|
1325
|
-
*
|
1326
|
-
*
|
1327
|
-
*
|
1374
|
+
* JavaScript:
|
1375
|
+
*
|
1376
|
+
* ```js
|
1377
|
+
* const feedHandle = await page.$('.feed');
|
1378
|
+
* expect(
|
1379
|
+
* await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))
|
1380
|
+
* ).toEqual(['Hello!', 'Hi!']);
|
1381
|
+
* ```
|
1382
|
+
*
|
1383
|
+
* @param selector - The selector to query for.
|
1384
|
+
* @param pageFunction - The function to be evaluated in the element's page's
|
1385
|
+
* context. An array of elements matching the given selector will be passed to
|
1386
|
+
* the function as its first argument.
|
1387
|
+
* @param args - Additional arguments to pass to `pageFunction`.
|
1388
|
+
* @returns A promise to the result of the function.
|
1389
|
+
*/
|
1390
|
+
$$eval<Selector extends string, Params extends unknown[], Func extends EvaluateFunc<[
|
1391
|
+
Array<NodeFor<Selector>>,
|
1392
|
+
...Params
|
1393
|
+
]> = EvaluateFunc<[Array<NodeFor<Selector>>, ...Params]>>(selector: Selector, pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
1394
|
+
/**
|
1395
|
+
* @deprecated Use {@link ElementHandle.$$} with the `xpath` prefix.
|
1396
|
+
*
|
1397
|
+
* The method evaluates the XPath expression relative to the elementHandle.
|
1398
|
+
* If there are no such elements, the method will resolve to an empty array.
|
1399
|
+
* @param expression - Expression to {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate | evaluate}
|
1400
|
+
*/
|
1401
|
+
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
|
1402
|
+
/**
|
1403
|
+
* Wait for an element matching the given selector to appear in the current
|
1404
|
+
* element.
|
1405
|
+
*
|
1406
|
+
* Unlike {@link Frame.waitForSelector}, this method does not work across
|
1407
|
+
* navigations or if the element is detached from DOM.
|
1408
|
+
*
|
1409
|
+
* @example
|
1410
|
+
*
|
1411
|
+
* ```ts
|
1412
|
+
* const puppeteer = require('puppeteer');
|
1413
|
+
*
|
1414
|
+
* (async () => {
|
1415
|
+
* const browser = await puppeteer.launch();
|
1416
|
+
* const page = await browser.newPage();
|
1417
|
+
* let currentURL;
|
1418
|
+
* page
|
1419
|
+
* .mainFrame()
|
1420
|
+
* .waitForSelector('img')
|
1421
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
1422
|
+
*
|
1423
|
+
* for (currentURL of [
|
1424
|
+
* 'https://example.com',
|
1425
|
+
* 'https://google.com',
|
1426
|
+
* 'https://bbc.com',
|
1427
|
+
* ]) {
|
1428
|
+
* await page.goto(currentURL);
|
1429
|
+
* }
|
1430
|
+
* await browser.close();
|
1431
|
+
* })();
|
1432
|
+
* ```
|
1433
|
+
*
|
1434
|
+
* @param selector - The selector to query and wait for.
|
1435
|
+
* @param options - Options for customizing waiting behavior.
|
1436
|
+
* @returns An element matching the given selector.
|
1437
|
+
* @throws Throws if an element matching the given selector doesn't appear.
|
1328
1438
|
*/
|
1329
1439
|
waitForSelector<Selector extends string>(selector: Selector, options?: Exclude<WaitForSelectorOptions, 'root'>): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
1330
1440
|
/**
|
1441
|
+
* @deprecated Use {@link ElementHandle.waitForSelector} with the `xpath`
|
1442
|
+
* prefix.
|
1443
|
+
*
|
1331
1444
|
* Wait for the `xpath` within the element. If at the moment of calling the
|
1332
1445
|
* method the `xpath` already exists, the method will return immediately. If
|
1333
1446
|
* the `xpath` doesn't appear after the `timeout` milliseconds of waiting, the
|
1334
1447
|
* function will throw.
|
1335
1448
|
*
|
1336
|
-
* If `xpath` starts with `//` instead of `.//`, the dot will be appended
|
1449
|
+
* If `xpath` starts with `//` instead of `.//`, the dot will be appended
|
1450
|
+
* automatically.
|
1337
1451
|
*
|
1338
1452
|
* This method works across navigation
|
1453
|
+
*
|
1339
1454
|
* ```ts
|
1340
1455
|
* const puppeteer = require('puppeteer');
|
1341
1456
|
* (async () => {
|
1342
|
-
*
|
1343
|
-
*
|
1344
|
-
*
|
1345
|
-
*
|
1346
|
-
*
|
1347
|
-
*
|
1348
|
-
*
|
1349
|
-
*
|
1350
|
-
*
|
1351
|
-
*
|
1352
|
-
*
|
1353
|
-
*
|
1354
|
-
*
|
1355
|
-
*
|
1457
|
+
* const browser = await puppeteer.launch();
|
1458
|
+
* const page = await browser.newPage();
|
1459
|
+
* let currentURL;
|
1460
|
+
* page
|
1461
|
+
* .waitForXPath('//img')
|
1462
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
1463
|
+
* for (currentURL of [
|
1464
|
+
* 'https://example.com',
|
1465
|
+
* 'https://google.com',
|
1466
|
+
* 'https://bbc.com',
|
1467
|
+
* ]) {
|
1468
|
+
* await page.goto(currentURL);
|
1469
|
+
* }
|
1470
|
+
* await browser.close();
|
1356
1471
|
* })();
|
1357
1472
|
* ```
|
1473
|
+
*
|
1358
1474
|
* @param xpath - A
|
1359
1475
|
* {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
|
1360
1476
|
* element to wait for
|
@@ -1366,16 +1482,17 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1366
1482
|
* The optional Argument `options` have properties:
|
1367
1483
|
*
|
1368
1484
|
* - `visible`: A boolean to wait for element to be present in DOM and to be
|
1369
|
-
*
|
1370
|
-
*
|
1485
|
+
* visible, i.e. to not have `display: none` or `visibility: hidden` CSS
|
1486
|
+
* properties. Defaults to `false`.
|
1371
1487
|
*
|
1372
1488
|
* - `hidden`: A boolean wait for element to not be found in the DOM or to be
|
1373
|
-
*
|
1374
|
-
*
|
1489
|
+
* hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
|
1490
|
+
* Defaults to `false`.
|
1375
1491
|
*
|
1376
1492
|
* - `timeout`: A number which is maximum time to wait for in milliseconds.
|
1377
|
-
*
|
1378
|
-
* value can be changed by using the {@link Page.setDefaultTimeout}
|
1493
|
+
* Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The
|
1494
|
+
* default value can be changed by using the {@link Page.setDefaultTimeout}
|
1495
|
+
* method.
|
1379
1496
|
*/
|
1380
1497
|
waitForXPath(xpath: string, options?: {
|
1381
1498
|
visible?: boolean;
|
@@ -1432,13 +1549,15 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1432
1549
|
* throws an error.
|
1433
1550
|
*
|
1434
1551
|
* @example
|
1552
|
+
*
|
1435
1553
|
* ```ts
|
1436
1554
|
* handle.select('blue'); // single selection
|
1437
1555
|
* handle.select('red', 'green', 'blue'); // multiple selections
|
1438
1556
|
* ```
|
1557
|
+
*
|
1439
1558
|
* @param values - Values of options to select. If the `<select>` has the
|
1440
|
-
*
|
1441
|
-
*
|
1559
|
+
* `multiple` attribute, all values are considered, otherwise only the first
|
1560
|
+
* one is taken into account.
|
1442
1561
|
*/
|
1443
1562
|
select(...values: string[]): Promise<string[]>;
|
1444
1563
|
/**
|
@@ -1446,10 +1565,10 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1446
1565
|
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input | input element}.
|
1447
1566
|
*
|
1448
1567
|
* @param filePaths - Sets the value of the file input to these paths.
|
1449
|
-
*
|
1450
|
-
*
|
1451
|
-
*
|
1452
|
-
*
|
1568
|
+
* If a path is relative, then it is resolved against the
|
1569
|
+
* {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}.
|
1570
|
+
* Note for locals script connecting to remote chrome environments,
|
1571
|
+
* paths must be absolute.
|
1453
1572
|
*/
|
1454
1573
|
uploadFile(this: ElementHandle<HTMLInputElement>, ...filePaths: string[]): Promise<void>;
|
1455
1574
|
/**
|
@@ -1470,6 +1589,7 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1470
1589
|
* use {@link ElementHandle.press}.
|
1471
1590
|
*
|
1472
1591
|
* @example
|
1592
|
+
*
|
1473
1593
|
* ```ts
|
1474
1594
|
* await elementHandle.type('Hello'); // Types instantly
|
1475
1595
|
* await elementHandle.type('World', {delay: 100}); // Types slower, like a user
|
@@ -1499,7 +1619,7 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1499
1619
|
* will type the text in upper case.
|
1500
1620
|
*
|
1501
1621
|
* @param key - Name of key to press, such as `ArrowLeft`.
|
1502
|
-
*
|
1622
|
+
* See {@link KeyInput} for a list of all key names.
|
1503
1623
|
*/
|
1504
1624
|
press(key: KeyInput, options?: PressOptions): Promise<void>;
|
1505
1625
|
/**
|
@@ -1522,78 +1642,6 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1522
1642
|
* If the element is detached from DOM, the method throws an error.
|
1523
1643
|
*/
|
1524
1644
|
screenshot(this: ElementHandle<Element>, options?: ScreenshotOptions): Promise<string | Buffer>;
|
1525
|
-
/**
|
1526
|
-
* Runs `element.querySelector` within the page.
|
1527
|
-
*
|
1528
|
-
* @param selector - The selector to query with.
|
1529
|
-
* @returns `null` if no element matches the selector.
|
1530
|
-
* @throws `Error` if the selector has no associated query handler.
|
1531
|
-
*/
|
1532
|
-
$<Selector extends string>(selector: Selector): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
1533
|
-
/**
|
1534
|
-
* Runs `element.querySelectorAll` within the page. If no elements match the selector,
|
1535
|
-
* the return value resolves to `[]`.
|
1536
|
-
*/
|
1537
|
-
/**
|
1538
|
-
* Runs `element.querySelectorAll` within the page.
|
1539
|
-
*
|
1540
|
-
* @param selector - The selector to query with.
|
1541
|
-
* @returns `[]` if no element matches the selector.
|
1542
|
-
* @throws `Error` if the selector has no associated query handler.
|
1543
|
-
*/
|
1544
|
-
$$<Selector extends string>(selector: Selector): Promise<Array<ElementHandle<NodeFor<Selector>>>>;
|
1545
|
-
/**
|
1546
|
-
* This method runs `document.querySelector` within the element and passes it as
|
1547
|
-
* the first argument to `pageFunction`. If there's no element matching `selector`,
|
1548
|
-
* the method throws an error.
|
1549
|
-
*
|
1550
|
-
* If `pageFunction` returns a Promise, then `frame.$eval` would wait for the promise
|
1551
|
-
* to resolve and return its value.
|
1552
|
-
*
|
1553
|
-
* @example
|
1554
|
-
* ```ts
|
1555
|
-
* const tweetHandle = await page.$('.tweet');
|
1556
|
-
* expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');
|
1557
|
-
* expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
|
1558
|
-
* ```
|
1559
|
-
*/
|
1560
|
-
$eval<Selector extends string, Params extends unknown[], Func extends EvaluateFunc<[
|
1561
|
-
ElementHandle<NodeFor<Selector>>,
|
1562
|
-
...Params
|
1563
|
-
]> = EvaluateFunc<[ElementHandle<NodeFor<Selector>>, ...Params]>>(selector: Selector, pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
1564
|
-
/**
|
1565
|
-
* This method runs `document.querySelectorAll` within the element and passes it as
|
1566
|
-
* the first argument to `pageFunction`. If there's no element matching `selector`,
|
1567
|
-
* the method throws an error.
|
1568
|
-
*
|
1569
|
-
* If `pageFunction` returns a Promise, then `frame.$$eval` would wait for the
|
1570
|
-
* promise to resolve and return its value.
|
1571
|
-
*
|
1572
|
-
* @example
|
1573
|
-
* ```html
|
1574
|
-
* <div class="feed">
|
1575
|
-
* <div class="tweet">Hello!</div>
|
1576
|
-
* <div class="tweet">Hi!</div>
|
1577
|
-
* </div>
|
1578
|
-
* ```
|
1579
|
-
*
|
1580
|
-
* @example
|
1581
|
-
* ```ts
|
1582
|
-
* const feedHandle = await page.$('.feed');
|
1583
|
-
* expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText)))
|
1584
|
-
* .toEqual(['Hello!', 'Hi!']);
|
1585
|
-
* ```
|
1586
|
-
*/
|
1587
|
-
$$eval<Selector extends string, Params extends unknown[], Func extends EvaluateFunc<[
|
1588
|
-
Array<NodeFor<Selector>>,
|
1589
|
-
...Params
|
1590
|
-
]> = EvaluateFunc<[Array<NodeFor<Selector>>, ...Params]>>(selector: Selector, pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
1591
|
-
/**
|
1592
|
-
* The method evaluates the XPath expression relative to the elementHandle.
|
1593
|
-
* If there are no such elements, the method will resolve to an empty array.
|
1594
|
-
* @param expression - Expression to {@link https://developer.mozilla.org/en-US/docs/Web/API/Document/evaluate | evaluate}
|
1595
|
-
*/
|
1596
|
-
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
|
1597
1645
|
/**
|
1598
1646
|
* Resolves to true if the element is visible in the current viewport.
|
1599
1647
|
*/
|
@@ -1609,8 +1657,6 @@ export declare class ElementHandle<ElementType extends Node = Element> extends J
|
|
1609
1657
|
*/
|
1610
1658
|
export declare type ErrorCode = 'aborted' | 'accessdenied' | 'addressunreachable' | 'blockedbyclient' | 'blockedbyresponse' | 'connectionaborted' | 'connectionclosed' | 'connectionfailed' | 'connectionrefused' | 'connectionreset' | 'internetdisconnected' | 'namenotresolved' | 'timedout' | 'failed';
|
1611
1659
|
|
1612
|
-
/* Excluded from this release type: ErrorLike */
|
1613
|
-
|
1614
1660
|
/**
|
1615
1661
|
* Puppeteer methods might throw errors if they are unable to fulfill a request.
|
1616
1662
|
* For example, `page.waitForSelector(selector[, options])` might fail if the
|
@@ -1621,6 +1667,7 @@ export declare type ErrorCode = 'aborted' | 'accessdenied' | 'addressunreachable
|
|
1621
1667
|
*
|
1622
1668
|
* @example
|
1623
1669
|
* An example of handling a timeout error:
|
1670
|
+
*
|
1624
1671
|
* ```ts
|
1625
1672
|
* try {
|
1626
1673
|
* await page.waitForSelector('.foo');
|
@@ -1666,14 +1713,14 @@ export declare class EventEmitter implements CommonEventEmitter {
|
|
1666
1713
|
/**
|
1667
1714
|
* Bind an event listener to fire when an event occurs.
|
1668
1715
|
* @param event - the event type you'd like to listen to. Can be a string or symbol.
|
1669
|
-
* @param handler
|
1716
|
+
* @param handler - the function to be called when the event occurs.
|
1670
1717
|
* @returns `this` to enable you to chain method calls.
|
1671
1718
|
*/
|
1672
1719
|
on(event: EventType, handler: Handler): EventEmitter;
|
1673
1720
|
/**
|
1674
1721
|
* Remove an event listener from firing.
|
1675
1722
|
* @param event - the event type you'd like to stop listening to.
|
1676
|
-
* @param handler
|
1723
|
+
* @param handler - the function that should be removed.
|
1677
1724
|
* @returns `this` to enable you to chain method calls.
|
1678
1725
|
*/
|
1679
1726
|
off(event: EventType, handler: Handler): EventEmitter;
|
@@ -1731,21 +1778,26 @@ export declare const executablePath: (channel?: string | undefined) => string;
|
|
1731
1778
|
/* Excluded from this release type: executablePathForChannel */
|
1732
1779
|
|
1733
1780
|
/**
|
1734
|
-
*
|
1735
|
-
* many execution contexts:
|
1736
|
-
* - each
|
1737
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe |
|
1738
|
-
* frame } has "default" execution context that is always created after frame is
|
1739
|
-
* attached to DOM. This context is returned by the
|
1740
|
-
* {@link Frame.executionContext} method.
|
1741
|
-
* - {@link https://developer.chrome.com/extensions | Extension}'s content scripts
|
1742
|
-
* create additional execution contexts.
|
1781
|
+
* @deprecated Do not use directly.
|
1743
1782
|
*
|
1744
|
-
*
|
1745
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API |
|
1746
|
-
* workers }.
|
1783
|
+
* Represents a context for JavaScript execution.
|
1747
1784
|
*
|
1748
|
-
* @
|
1785
|
+
* @example
|
1786
|
+
* A {@link Page} can have several execution contexts:
|
1787
|
+
*
|
1788
|
+
* - Each {@link Frame} of a {@link Page | page} has a "default" execution
|
1789
|
+
* context that is always created after frame is attached to DOM. This context
|
1790
|
+
* is returned by the {@link Frame.executionContext} method.
|
1791
|
+
* - Each {@link https://developer.chrome.com/extensions | Chrome extensions}
|
1792
|
+
* creates additional execution contexts to isolate their code.
|
1793
|
+
*
|
1794
|
+
* @remarks
|
1795
|
+
* By definition, each context is isolated from one another, however they are
|
1796
|
+
* all able to manipulate non-JavaScript resources (such as DOM).
|
1797
|
+
*
|
1798
|
+
* @remarks
|
1799
|
+
* Besides pages, execution contexts can be found in
|
1800
|
+
* {@link WebWorker | workers}.
|
1749
1801
|
*/
|
1750
1802
|
export declare class ExecutionContext {
|
1751
1803
|
#private;
|
@@ -1755,27 +1807,19 @@ export declare class ExecutionContext {
|
|
1755
1807
|
/* Excluded from this release type: _contextName */
|
1756
1808
|
/* Excluded from this release type: __constructor */
|
1757
1809
|
/**
|
1758
|
-
* @remarks
|
1759
|
-
*
|
1760
|
-
* Not every execution context is associated with a frame. For
|
1761
|
-
* example, workers and extensions have execution contexts that are not
|
1762
|
-
* associated with frames.
|
1763
|
-
*
|
1764
1810
|
* @returns The frame associated with this execution context.
|
1811
|
+
*
|
1812
|
+
* @remarks
|
1813
|
+
* Not every execution context is associated with a frame. For example,
|
1814
|
+
* {@link WebWorker | workers} have execution contexts that are not associated
|
1815
|
+
* with frames.
|
1765
1816
|
*/
|
1766
1817
|
frame(): Frame | null;
|
1767
1818
|
/**
|
1768
|
-
*
|
1769
|
-
* If the function passed to the `executionContext.evaluate` returns a
|
1770
|
-
* Promise, then `executionContext.evaluate` would wait for the promise to
|
1771
|
-
* resolve and return its value. If the function passed to the
|
1772
|
-
* `executionContext.evaluate` returns a non-serializable value, then
|
1773
|
-
* `executionContext.evaluate` resolves to `undefined`. DevTools Protocol also
|
1774
|
-
* supports transferring some additional values that are not serializable by
|
1775
|
-
* `JSON`: `-0`, `NaN`, `Infinity`, `-Infinity`, and bigint literals.
|
1776
|
-
*
|
1819
|
+
* Evaluates the given function.
|
1777
1820
|
*
|
1778
1821
|
* @example
|
1822
|
+
*
|
1779
1823
|
* ```ts
|
1780
1824
|
* const executionContext = await page.mainFrame().executionContext();
|
1781
1825
|
* const result = await executionContext.evaluate(() => Promise.resolve(8 * 7))* ;
|
@@ -1783,82 +1827,94 @@ export declare class ExecutionContext {
|
|
1783
1827
|
* ```
|
1784
1828
|
*
|
1785
1829
|
* @example
|
1786
|
-
* A string can also be passed in instead of a function
|
1830
|
+
* A string can also be passed in instead of a function:
|
1787
1831
|
*
|
1788
1832
|
* ```ts
|
1789
1833
|
* console.log(await executionContext.evaluate('1 + 2')); // prints "3"
|
1790
1834
|
* ```
|
1791
1835
|
*
|
1792
1836
|
* @example
|
1793
|
-
*
|
1794
|
-
*
|
1837
|
+
* Handles can also be passed as `args`. They resolve to their referenced object:
|
1838
|
+
*
|
1795
1839
|
* ```ts
|
1796
1840
|
* const oneHandle = await executionContext.evaluateHandle(() => 1);
|
1797
1841
|
* const twoHandle = await executionContext.evaluateHandle(() => 2);
|
1798
1842
|
* const result = await executionContext.evaluate(
|
1799
|
-
*
|
1843
|
+
* (a, b) => a + b,
|
1844
|
+
* oneHandle,
|
1845
|
+
* twoHandle
|
1800
1846
|
* );
|
1801
1847
|
* await oneHandle.dispose();
|
1802
1848
|
* await twoHandle.dispose();
|
1803
1849
|
* console.log(result); // prints '3'.
|
1804
1850
|
* ```
|
1805
|
-
* @param pageFunction - a function to be evaluated in the `executionContext`
|
1806
|
-
* @param args - argument to pass to the page function
|
1807
1851
|
*
|
1808
|
-
* @
|
1852
|
+
* @param pageFunction - The function to evaluate.
|
1853
|
+
* @param args - Additional arguments to pass into the function.
|
1854
|
+
* @returns The result of evaluating the function. If the result is an object,
|
1855
|
+
* a vanilla object containing the serializable properties of the result is
|
1856
|
+
* returned.
|
1809
1857
|
*/
|
1810
1858
|
evaluate<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
1811
1859
|
/**
|
1812
|
-
*
|
1813
|
-
*
|
1814
|
-
*
|
1815
|
-
*
|
1816
|
-
*
|
1817
|
-
*
|
1818
|
-
*
|
1860
|
+
* Evaluates the given function.
|
1861
|
+
*
|
1862
|
+
* Unlike {@link ExecutionContext.evaluate | evaluate}, this method returns a
|
1863
|
+
* handle to the result of the function.
|
1864
|
+
*
|
1865
|
+
* This method may be better suited if the object cannot be serialized (e.g.
|
1866
|
+
* `Map`) and requires further manipulation.
|
1819
1867
|
*
|
1820
1868
|
* @example
|
1869
|
+
*
|
1821
1870
|
* ```ts
|
1822
1871
|
* const context = await page.mainFrame().executionContext();
|
1823
|
-
* const
|
1824
|
-
*
|
1872
|
+
* const handle: JSHandle<typeof globalThis> = await context.evaluateHandle(
|
1873
|
+
* () => Promise.resolve(self)
|
1874
|
+
* );
|
1825
1875
|
* ```
|
1826
1876
|
*
|
1827
1877
|
* @example
|
1828
1878
|
* A string can also be passed in instead of a function.
|
1829
1879
|
*
|
1830
1880
|
* ```ts
|
1831
|
-
*
|
1832
|
-
* const aHandle = await context.evaluateHandle('1 + 2');
|
1881
|
+
* const handle: JSHandle<number> = await context.evaluateHandle('1 + 2');
|
1833
1882
|
* ```
|
1834
1883
|
*
|
1835
1884
|
* @example
|
1836
|
-
*
|
1837
|
-
* to the `executionContext.* evaluateHandle`:
|
1885
|
+
* Handles can also be passed as `args`. They resolve to their referenced object:
|
1838
1886
|
*
|
1839
1887
|
* ```ts
|
1840
|
-
* const
|
1841
|
-
*
|
1842
|
-
*
|
1843
|
-
*
|
1844
|
-
* await
|
1888
|
+
* const bodyHandle: ElementHandle<HTMLBodyElement> =
|
1889
|
+
* await context.evaluateHandle(() => {
|
1890
|
+
* return document.body;
|
1891
|
+
* });
|
1892
|
+
* const stringHandle: JSHandle<string> = await context.evaluateHandle(
|
1893
|
+
* body => body.innerHTML,
|
1894
|
+
* body
|
1895
|
+
* );
|
1896
|
+
* console.log(await stringHandle.jsonValue()); // prints body's innerHTML
|
1897
|
+
* // Always dispose your garbage! :)
|
1898
|
+
* await bodyHandle.dispose();
|
1899
|
+
* await stringHandle.dispose();
|
1845
1900
|
* ```
|
1846
1901
|
*
|
1847
|
-
* @param pageFunction -
|
1848
|
-
* @param args -
|
1849
|
-
*
|
1850
|
-
*
|
1851
|
-
*
|
1902
|
+
* @param pageFunction - The function to evaluate.
|
1903
|
+
* @param args - Additional arguments to pass into the function.
|
1904
|
+
* @returns A {@link JSHandle | handle} to the result of evaluating the
|
1905
|
+
* function. If the result is a `Node`, then this will return an
|
1906
|
+
* {@link ElementHandle | element handle}.
|
1852
1907
|
*/
|
1853
1908
|
evaluateHandle<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
1854
1909
|
/**
|
1855
|
-
*
|
1910
|
+
* Iterates through the JavaScript heap and finds all the objects with the
|
1856
1911
|
* given prototype.
|
1857
|
-
*
|
1912
|
+
*
|
1858
1913
|
* @example
|
1914
|
+
*
|
1859
1915
|
* ```ts
|
1860
1916
|
* // Create a Map object
|
1861
|
-
* await page.evaluate(() => window.map = new Map());
|
1917
|
+
* await page.evaluate(() => (window.map = new Map()));
|
1862
1918
|
* // Get a handle to the Map object prototype
|
1863
1919
|
* const mapPrototype = await page.evaluateHandle(() => Map.prototype);
|
1864
1920
|
* // Query all map instances into an array
|
@@ -1870,22 +1926,25 @@ export declare class ExecutionContext {
|
|
1870
1926
|
* ```
|
1871
1927
|
*
|
1872
1928
|
* @param prototypeHandle - a handle to the object prototype
|
1873
|
-
*
|
1874
1929
|
* @returns A handle to an array of objects with the given prototype.
|
1875
1930
|
*/
|
1876
1931
|
queryObjects<Prototype>(prototypeHandle: JSHandle<Prototype>): Promise<HandleFor<Prototype[]>>;
|
1877
|
-
/* Excluded from this release type: _adoptBackendNodeId */
|
1878
|
-
/* Excluded from this release type: _adoptElementHandle */
|
1879
1932
|
}
|
1880
1933
|
|
1881
1934
|
/* Excluded from this release type: FetchRequestId */
|
1882
1935
|
|
1883
1936
|
/**
|
1884
1937
|
* File choosers let you react to the page requesting for a file.
|
1938
|
+
*
|
1885
1939
|
* @remarks
|
1886
|
-
* `FileChooser`
|
1940
|
+
* `FileChooser` instances are returned via the {@link Page.waitForFileChooser} method.
|
1941
|
+
*
|
1942
|
+
* In browsers, only one file chooser can be opened at a time.
|
1943
|
+
* All file choosers must be accepted or canceled. Not doing so will prevent
|
1944
|
+
* subsequent file choosers from appearing.
|
1945
|
+
*
|
1887
1946
|
* @example
|
1888
|
-
*
|
1947
|
+
*
|
1889
1948
|
* ```ts
|
1890
1949
|
* const [fileChooser] = await Promise.all([
|
1891
1950
|
* page.waitForFileChooser(),
|
@@ -1893,22 +1952,24 @@ export declare class ExecutionContext {
|
|
1893
1952
|
* ]);
|
1894
1953
|
* await fileChooser.accept(['/tmp/myfile.pdf']);
|
1895
1954
|
* ```
|
1896
|
-
*
|
1897
|
-
* All file choosers must be accepted or canceled. Not doing so will prevent
|
1898
|
-
* subsequent file choosers from appearing.
|
1955
|
+
*
|
1899
1956
|
* @public
|
1900
1957
|
*/
|
1901
1958
|
export declare class FileChooser {
|
1902
1959
|
#private;
|
1903
1960
|
/* Excluded from this release type: __constructor */
|
1904
1961
|
/**
|
1905
|
-
* Whether file chooser allow for
|
1962
|
+
* Whether file chooser allow for
|
1963
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file#attr-multiple | multiple}
|
1964
|
+
* file selection.
|
1906
1965
|
*/
|
1907
1966
|
isMultiple(): boolean;
|
1908
1967
|
/**
|
1909
1968
|
* Accept the file chooser request with given paths.
|
1910
|
-
*
|
1911
|
-
*
|
1969
|
+
*
|
1970
|
+
* @param filePaths - If some of the `filePaths` are relative paths, then
|
1971
|
+
* they are resolved relative to the
|
1972
|
+
* {@link https://nodejs.org/api/process.html#process_process_cwd | current working directory}.
|
1912
1973
|
*/
|
1913
1974
|
accept(filePaths: string[]): Promise<void>;
|
1914
1975
|
/**
|
@@ -1927,22 +1988,18 @@ export declare class FileChooser {
|
|
1927
1988
|
export declare type FlattenHandle<T> = T extends HandleOr<infer U> ? U : never;
|
1928
1989
|
|
1929
1990
|
/**
|
1930
|
-
*
|
1931
|
-
* {@link Page.mainFrame | page.mainFrame} and
|
1932
|
-
* {@link Frame.childFrames | frame.childFrames} methods.
|
1991
|
+
* Represents a DOM frame.
|
1933
1992
|
*
|
1934
|
-
*
|
1935
|
-
*
|
1936
|
-
*
|
1937
|
-
*
|
1938
|
-
*
|
1939
|
-
* - {@link PageEmittedEvents.FrameAttached}
|
1993
|
+
* To understand frames, you can think of frames as `<iframe>` elements. Just
|
1994
|
+
* like iframes, frames can be nested, and when JavaScript is executed in a
|
1995
|
+
* frame, the JavaScript does not effect frames inside the ambient frame the
|
1996
|
+
* JavaScript executes in.
|
1940
1997
|
*
|
1941
|
-
*
|
1942
|
-
*
|
1943
|
-
*
|
1998
|
+
* @example
|
1999
|
+
* At any point in time, {@link Page | pages} expose their current frame
|
2000
|
+
* tree via the {@link Page.mainFrame} and {@link Frame.childFrames} methods.
|
1944
2001
|
*
|
1945
|
-
* @
|
2002
|
+
* @example
|
1946
2003
|
* An example of dumping frame tree:
|
1947
2004
|
*
|
1948
2005
|
* ```ts
|
@@ -1958,13 +2015,13 @@ export declare type FlattenHandle<T> = T extends HandleOr<infer U> ? U : never;
|
|
1958
2015
|
* function dumpFrameTree(frame, indent) {
|
1959
2016
|
* console.log(indent + frame.url());
|
1960
2017
|
* for (const child of frame.childFrames()) {
|
1961
|
-
*
|
2018
|
+
* dumpFrameTree(child, indent + ' ');
|
1962
2019
|
* }
|
1963
2020
|
* }
|
1964
2021
|
* })();
|
1965
2022
|
* ```
|
1966
2023
|
*
|
1967
|
-
* @
|
2024
|
+
* @example
|
1968
2025
|
* An example of getting text from an iframe element:
|
1969
2026
|
*
|
1970
2027
|
* ```ts
|
@@ -1973,59 +2030,52 @@ export declare type FlattenHandle<T> = T extends HandleOr<infer U> ? U : never;
|
|
1973
2030
|
* console.log(text);
|
1974
2031
|
* ```
|
1975
2032
|
*
|
2033
|
+
* @remarks
|
2034
|
+
* Frame lifecycles are controlled by three events that are all dispatched on
|
2035
|
+
* the parent {@link Frame.page | page}:
|
2036
|
+
*
|
2037
|
+
* - {@link PageEmittedEvents.FrameAttached}
|
2038
|
+
* - {@link PageEmittedEvents.FrameNavigated}
|
2039
|
+
* - {@link PageEmittedEvents.FrameDetached}
|
2040
|
+
*
|
1976
2041
|
* @public
|
1977
2042
|
*/
|
1978
2043
|
export declare class Frame {
|
1979
2044
|
#private;
|
2045
|
+
/* Excluded from this release type: worlds */
|
1980
2046
|
/* Excluded from this release type: _frameManager */
|
1981
2047
|
/* Excluded from this release type: _id */
|
1982
2048
|
/* Excluded from this release type: _loaderId */
|
1983
2049
|
/* Excluded from this release type: _name */
|
1984
2050
|
/* Excluded from this release type: _hasStartedLoading */
|
1985
2051
|
/* Excluded from this release type: _lifecycleEvents */
|
1986
|
-
/* Excluded from this release type: _mainWorld */
|
1987
|
-
/* Excluded from this release type: _secondaryWorld */
|
1988
2052
|
/* Excluded from this release type: _childFrames */
|
1989
2053
|
/* Excluded from this release type: __constructor */
|
1990
|
-
/* Excluded from this release type:
|
2054
|
+
/* Excluded from this release type: updateClient */
|
1991
2055
|
/**
|
1992
|
-
* @returns
|
2056
|
+
* @returns The page associated with the frame.
|
1993
2057
|
*/
|
1994
2058
|
page(): Page;
|
1995
2059
|
/**
|
1996
|
-
* @
|
1997
|
-
*
|
1998
|
-
* @returns `true` if the frame is an OOP frame, or `false` otherwise.
|
2060
|
+
* @returns `true` if the frame is an out-of-process (OOP) frame. Otherwise,
|
2061
|
+
* `false`.
|
1999
2062
|
*/
|
2000
2063
|
isOOPFrame(): boolean;
|
2001
2064
|
/**
|
2002
|
-
*
|
2003
|
-
*
|
2004
|
-
* `frame.goto` will throw an error if:
|
2005
|
-
* - there's an SSL error (e.g. in case of self-signed certificates).
|
2006
|
-
*
|
2007
|
-
* - target URL is invalid.
|
2065
|
+
* Navigates a frame to the given url.
|
2008
2066
|
*
|
2009
|
-
*
|
2010
|
-
*
|
2011
|
-
*
|
2012
|
-
*
|
2013
|
-
* - the main resource failed to load.
|
2014
|
-
*
|
2015
|
-
* `frame.goto` will not throw an error when any valid HTTP status code is
|
2016
|
-
* returned by the remote server, including 404 "Not Found" and 500 "Internal
|
2017
|
-
* Server Error". The status code for such responses can be retrieved by
|
2018
|
-
* calling {@link HTTPResponse.status}.
|
2067
|
+
* @remarks
|
2068
|
+
* Navigation to `about:blank` or navigation to the same URL with a different
|
2069
|
+
* hash will succeed and return `null`.
|
2019
2070
|
*
|
2020
|
-
*
|
2021
|
-
* response. The only exceptions are navigation to `about:blank` or
|
2022
|
-
* navigation to the same URL with a different hash, which would succeed and
|
2023
|
-
* return `null`.
|
2071
|
+
* :::warning
|
2024
2072
|
*
|
2025
|
-
*
|
2026
|
-
*
|
2073
|
+
* Headless mode doesn't support navigation to a PDF document. See the {@link
|
2074
|
+
* https://bugs.chromium.org/p/chromium/issues/detail?id=761295 | upstream
|
2027
2075
|
* issue}.
|
2028
2076
|
*
|
2077
|
+
* :::
|
2078
|
+
*
|
2029
2079
|
* @param url - the URL to navigate the frame to. This should include the
|
2030
2080
|
* scheme, e.g. `https://`.
|
2031
2081
|
* @param options - navigation options. `waitUntil` is useful to define when
|
@@ -2035,6 +2085,18 @@ export declare class Frame {
|
|
2035
2085
|
* @returns A promise which resolves to the main resource response. In case of
|
2036
2086
|
* multiple redirects, the navigation will resolve with the response of the
|
2037
2087
|
* last redirect.
|
2088
|
+
* @throws This method will throw an error if:
|
2089
|
+
*
|
2090
|
+
* - there's an SSL error (e.g. in case of self-signed certificates).
|
2091
|
+
* - target URL is invalid.
|
2092
|
+
* - the `timeout` is exceeded during navigation.
|
2093
|
+
* - the remote server does not respond or is unreachable.
|
2094
|
+
* - the main resource failed to load.
|
2095
|
+
*
|
2096
|
+
* This method will not throw an error when any valid HTTP status code is
|
2097
|
+
* returned by the remote server, including 404 "Not Found" and 500 "Internal
|
2098
|
+
* Server Error". The status code for such responses can be retrieved by
|
2099
|
+
* calling {@link HTTPResponse.status}.
|
2038
2100
|
*/
|
2039
2101
|
goto(url: string, options?: {
|
2040
2102
|
referer?: string;
|
@@ -2042,11 +2104,14 @@ export declare class Frame {
|
|
2042
2104
|
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
2043
2105
|
}): Promise<HTTPResponse | null>;
|
2044
2106
|
/**
|
2045
|
-
*
|
2107
|
+
* Waits for the frame to navigate. It is useful for when you run code which
|
2108
|
+
* will indirectly cause the frame to navigate.
|
2046
2109
|
*
|
2047
|
-
*
|
2048
|
-
*
|
2049
|
-
*
|
2110
|
+
* Usage of the
|
2111
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/API/History_API | History API}
|
2112
|
+
* to change the URL is considered a navigation.
|
2113
|
+
*
|
2114
|
+
* @example
|
2050
2115
|
*
|
2051
2116
|
* ```ts
|
2052
2117
|
* const [response] = await Promise.all([
|
@@ -2057,9 +2122,8 @@ export declare class Frame {
|
|
2057
2122
|
* ]);
|
2058
2123
|
* ```
|
2059
2124
|
*
|
2060
|
-
*
|
2061
|
-
*
|
2062
|
-
* @param options - options to configure when the navigation is consided finished.
|
2125
|
+
* @param options - options to configure when the navigation is consided
|
2126
|
+
* finished.
|
2063
2127
|
* @returns a promise that resolves when the frame navigates to a new URL.
|
2064
2128
|
*/
|
2065
2129
|
waitForNavigation(options?: {
|
@@ -2068,62 +2132,47 @@ export declare class Frame {
|
|
2068
2132
|
}): Promise<HTTPResponse | null>;
|
2069
2133
|
/* Excluded from this release type: _client */
|
2070
2134
|
/**
|
2135
|
+
* @deprecated Do not use the execution context directly.
|
2136
|
+
*
|
2071
2137
|
* @returns a promise that resolves to the frame's default execution context.
|
2072
2138
|
*/
|
2073
2139
|
executionContext(): Promise<ExecutionContext>;
|
2074
2140
|
/**
|
2075
|
-
* @
|
2076
|
-
*
|
2077
|
-
* The only difference between {@link Frame.evaluate} and
|
2078
|
-
* `frame.evaluateHandle` is that `evaluateHandle` will return the value
|
2079
|
-
* wrapped in an in-page object.
|
2080
|
-
*
|
2081
|
-
* This method behaves identically to {@link Page.evaluateHandle} except it's
|
2082
|
-
* run within the context of the `frame`, rather than the entire page.
|
2141
|
+
* Behaves identically to {@link Page.evaluateHandle} except it's run within
|
2142
|
+
* the context of this frame.
|
2083
2143
|
*
|
2084
|
-
* @
|
2085
|
-
* @param args - arguments to be passed to the pageFunction
|
2144
|
+
* @see {@link Page.evaluateHandle} for details.
|
2086
2145
|
*/
|
2087
2146
|
evaluateHandle<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
2088
2147
|
/**
|
2089
|
-
* @
|
2090
|
-
*
|
2091
|
-
* This method behaves identically to {@link Page.evaluate} except it's run
|
2092
|
-
* within the context of the `frame`, rather than the entire page.
|
2148
|
+
* Behaves identically to {@link Page.evaluate} except it's run within the
|
2149
|
+
* the context of this frame.
|
2093
2150
|
*
|
2094
|
-
* @
|
2095
|
-
* @param args - arguments to be passed to the pageFunction
|
2151
|
+
* @see {@link Page.evaluate} for details.
|
2096
2152
|
*/
|
2097
2153
|
evaluate<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
2098
2154
|
/**
|
2099
|
-
*
|
2155
|
+
* Queries the frame for an element matching the given selector.
|
2100
2156
|
*
|
2101
|
-
* @param selector -
|
2102
|
-
* @returns A
|
2103
|
-
*
|
2157
|
+
* @param selector - The selector to query for.
|
2158
|
+
* @returns A {@link ElementHandle | element handle} to the first element
|
2159
|
+
* matching the given selector. Otherwise, `null`.
|
2104
2160
|
*/
|
2105
2161
|
$<Selector extends string>(selector: Selector): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
2106
2162
|
/**
|
2107
|
-
*
|
2163
|
+
* Queries the frame for all elements matching the given selector.
|
2108
2164
|
*
|
2109
|
-
* @param selector -
|
2110
|
-
* @returns An array of
|
2165
|
+
* @param selector - The selector to query for.
|
2166
|
+
* @returns An array of {@link ElementHandle | element handles} that point to
|
2167
|
+
* elements matching the given selector.
|
2111
2168
|
*/
|
2112
2169
|
$$<Selector extends string>(selector: Selector): Promise<Array<ElementHandle<NodeFor<Selector>>>>;
|
2113
2170
|
/**
|
2114
|
-
*
|
2171
|
+
* Runs the given function on the first element matching the given selector in
|
2172
|
+
* the frame.
|
2115
2173
|
*
|
2116
|
-
*
|
2117
|
-
|
2118
|
-
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
|
2119
|
-
/**
|
2120
|
-
* @remarks
|
2121
|
-
*
|
2122
|
-
* This method runs `document.querySelector` within
|
2123
|
-
* the frame and passes it as the first argument to `pageFunction`.
|
2124
|
-
*
|
2125
|
-
* If `pageFunction` returns a Promise, then `frame.$eval` would wait for
|
2126
|
-
* the promise to resolve and return its value.
|
2174
|
+
* If the given function returns a promise, then this method will wait till
|
2175
|
+
* the promise resolves.
|
2127
2176
|
*
|
2128
2177
|
* @example
|
2129
2178
|
*
|
@@ -2131,46 +2180,144 @@ export declare class Frame {
|
|
2131
2180
|
* const searchValue = await frame.$eval('#search', el => el.value);
|
2132
2181
|
* ```
|
2133
2182
|
*
|
2134
|
-
* @param selector -
|
2135
|
-
* @param pageFunction -
|
2136
|
-
*
|
2183
|
+
* @param selector - The selector to query for.
|
2184
|
+
* @param pageFunction - The function to be evaluated in the frame's context.
|
2185
|
+
* The first element matching the selector will be passed to the function as
|
2186
|
+
* its first argument.
|
2187
|
+
* @param args - Additional arguments to pass to `pageFunction`.
|
2188
|
+
* @returns A promise to the result of the function.
|
2137
2189
|
*/
|
2138
2190
|
$eval<Selector extends string, Params extends unknown[], Func extends EvaluateFunc<[
|
2139
2191
|
ElementHandle<NodeFor<Selector>>,
|
2140
2192
|
...Params
|
2141
2193
|
]> = EvaluateFunc<[ElementHandle<NodeFor<Selector>>, ...Params]>>(selector: Selector, pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
2142
2194
|
/**
|
2143
|
-
*
|
2144
|
-
*
|
2145
|
-
* This method runs `Array.from(document.querySelectorAll(selector))` within
|
2146
|
-
* the frame and passes it as the first argument to `pageFunction`.
|
2195
|
+
* Runs the given function on an array of elements matching the given selector
|
2196
|
+
* in the frame.
|
2147
2197
|
*
|
2148
|
-
* If
|
2149
|
-
* the promise
|
2198
|
+
* If the given function returns a promise, then this method will wait till
|
2199
|
+
* the promise resolves.
|
2150
2200
|
*
|
2151
2201
|
* @example
|
2152
2202
|
*
|
2153
|
-
* ```
|
2203
|
+
* ```js
|
2154
2204
|
* const divsCounts = await frame.$$eval('div', divs => divs.length);
|
2155
2205
|
* ```
|
2156
2206
|
*
|
2157
|
-
* @param selector -
|
2158
|
-
* @param pageFunction -
|
2159
|
-
*
|
2207
|
+
* @param selector - The selector to query for.
|
2208
|
+
* @param pageFunction - The function to be evaluated in the frame's context.
|
2209
|
+
* An array of elements matching the given selector will be passed to the
|
2210
|
+
* function as its first argument.
|
2211
|
+
* @param args - Additional arguments to pass to `pageFunction`.
|
2212
|
+
* @returns A promise to the result of the function.
|
2160
2213
|
*/
|
2161
2214
|
$$eval<Selector extends string, Params extends unknown[], Func extends EvaluateFunc<[
|
2162
2215
|
Array<NodeFor<Selector>>,
|
2163
2216
|
...Params
|
2164
2217
|
]> = EvaluateFunc<[Array<NodeFor<Selector>>, ...Params]>>(selector: Selector, pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
2165
2218
|
/**
|
2166
|
-
* @
|
2219
|
+
* @deprecated Use {@link Frame.$$} with the `xpath` prefix.
|
2220
|
+
*
|
2221
|
+
* This method evaluates the given XPath expression and returns the results.
|
2222
|
+
* @param expression - the XPath expression to evaluate.
|
2223
|
+
*/
|
2224
|
+
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
|
2225
|
+
/**
|
2226
|
+
* Waits for an element matching the given selector to appear in the frame.
|
2227
|
+
*
|
2228
|
+
* This method works across navigations.
|
2229
|
+
*
|
2230
|
+
* @example
|
2231
|
+
*
|
2232
|
+
* ```ts
|
2233
|
+
* const puppeteer = require('puppeteer');
|
2234
|
+
*
|
2235
|
+
* (async () => {
|
2236
|
+
* const browser = await puppeteer.launch();
|
2237
|
+
* const page = await browser.newPage();
|
2238
|
+
* let currentURL;
|
2239
|
+
* page
|
2240
|
+
* .mainFrame()
|
2241
|
+
* .waitForSelector('img')
|
2242
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
2243
|
+
*
|
2244
|
+
* for (currentURL of [
|
2245
|
+
* 'https://example.com',
|
2246
|
+
* 'https://google.com',
|
2247
|
+
* 'https://bbc.com',
|
2248
|
+
* ]) {
|
2249
|
+
* await page.goto(currentURL);
|
2250
|
+
* }
|
2251
|
+
* await browser.close();
|
2252
|
+
* })();
|
2253
|
+
* ```
|
2254
|
+
*
|
2255
|
+
* @param selector - The selector to query and wait for.
|
2256
|
+
* @param options - Options for customizing waiting behavior.
|
2257
|
+
* @returns An element matching the given selector.
|
2258
|
+
* @throws Throws if an element matching the given selector doesn't appear.
|
2259
|
+
*/
|
2260
|
+
waitForSelector<Selector extends string>(selector: Selector, options?: WaitForSelectorOptions): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
2261
|
+
/**
|
2262
|
+
* @deprecated Use {@link Frame.waitForSelector} with the `xpath` prefix.
|
2263
|
+
*
|
2264
|
+
* Wait for the `xpath` to appear in page. If at the moment of calling the
|
2265
|
+
* method the `xpath` already exists, the method will return immediately. If
|
2266
|
+
* the xpath doesn't appear after the `timeout` milliseconds of waiting, the
|
2267
|
+
* function will throw.
|
2268
|
+
*
|
2269
|
+
* For a code example, see the example for {@link Frame.waitForSelector}. That
|
2270
|
+
* function behaves identically other than taking a CSS selector rather than
|
2271
|
+
* an XPath.
|
2272
|
+
*
|
2273
|
+
* @param xpath - the XPath expression to wait for.
|
2274
|
+
* @param options - options to configure the visiblity of the element and how
|
2275
|
+
* long to wait before timing out.
|
2276
|
+
*/
|
2277
|
+
waitForXPath(xpath: string, options?: WaitForSelectorOptions): Promise<ElementHandle<Node> | null>;
|
2278
|
+
/**
|
2279
|
+
* @example
|
2280
|
+
* The `waitForFunction` can be used to observe viewport size change:
|
2281
|
+
*
|
2282
|
+
* ```ts
|
2283
|
+
* const puppeteer = require('puppeteer');
|
2284
|
+
*
|
2285
|
+
* (async () => {
|
2286
|
+
* . const browser = await puppeteer.launch();
|
2287
|
+
* . const page = await browser.newPage();
|
2288
|
+
* . const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
|
2289
|
+
* . page.setViewport({width: 50, height: 50});
|
2290
|
+
* . await watchDog;
|
2291
|
+
* . await browser.close();
|
2292
|
+
* })();
|
2293
|
+
* ```
|
2294
|
+
*
|
2295
|
+
* To pass arguments from Node.js to the predicate of `page.waitForFunction` function:
|
2296
|
+
*
|
2297
|
+
* ```ts
|
2298
|
+
* const selector = '.foo';
|
2299
|
+
* await frame.waitForFunction(
|
2300
|
+
* selector => !!document.querySelector(selector),
|
2301
|
+
* {}, // empty options object
|
2302
|
+
* selector
|
2303
|
+
* );
|
2304
|
+
* ```
|
2305
|
+
*
|
2306
|
+
* @param pageFunction - the function to evaluate in the frame context.
|
2307
|
+
* @param options - options to configure the polling method and timeout.
|
2308
|
+
* @param args - arguments to pass to the `pageFunction`.
|
2309
|
+
* @returns the promise which resolve when the `pageFunction` returns a truthy value.
|
2310
|
+
*/
|
2311
|
+
waitForFunction<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, options?: FrameWaitForFunctionOptions, ...args: Params): Promise<HandleFor<Awaited<ReturnType<Func>>>>;
|
2312
|
+
/**
|
2313
|
+
* @returns The full HTML contents of the frame, including the DOCTYPE.
|
2167
2314
|
*/
|
2168
2315
|
content(): Promise<string>;
|
2169
2316
|
/**
|
2170
2317
|
* Set the content of the frame.
|
2171
2318
|
*
|
2172
2319
|
* @param html - HTML markup to assign to the page.
|
2173
|
-
* @param options -
|
2320
|
+
* @param options - Options to configure how long before timing out and at
|
2174
2321
|
* what point to consider the content setting successful.
|
2175
2322
|
*/
|
2176
2323
|
setContent(html: string, options?: {
|
@@ -2178,37 +2325,36 @@ export declare class Frame {
|
|
2178
2325
|
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
2179
2326
|
}): Promise<void>;
|
2180
2327
|
/**
|
2181
|
-
* @
|
2328
|
+
* @returns The frame's `name` attribute as specified in the tag.
|
2182
2329
|
*
|
2330
|
+
* @remarks
|
2183
2331
|
* If the name is empty, it returns the `id` attribute instead.
|
2184
2332
|
*
|
2185
|
-
*
|
2333
|
+
* @remarks
|
2334
|
+
* This value is calculated once when the frame is created, and will not
|
2186
2335
|
* update if the attribute is changed later.
|
2187
|
-
*
|
2188
|
-
* @returns the frame's `name` attribute as specified in the tag.
|
2189
2336
|
*/
|
2190
2337
|
name(): string;
|
2191
2338
|
/**
|
2192
|
-
* @returns
|
2339
|
+
* @returns The frame's URL.
|
2193
2340
|
*/
|
2194
2341
|
url(): string;
|
2195
2342
|
/**
|
2196
|
-
* @returns
|
2343
|
+
* @returns The parent frame, if any. Detached and main frames return `null`.
|
2197
2344
|
*/
|
2198
2345
|
parentFrame(): Frame | null;
|
2199
2346
|
/**
|
2200
|
-
* @returns
|
2347
|
+
* @returns An array of child frames.
|
2201
2348
|
*/
|
2202
2349
|
childFrames(): Frame[];
|
2203
2350
|
/**
|
2204
|
-
* @returns `true` if the frame has been detached,
|
2351
|
+
* @returns `true` if the frame has been detached. Otherwise, `false`.
|
2205
2352
|
*/
|
2206
2353
|
isDetached(): boolean;
|
2207
2354
|
/**
|
2208
2355
|
* Adds a `<script>` tag into the page with the desired url or content.
|
2209
2356
|
*
|
2210
|
-
* @param options -
|
2211
|
-
*
|
2357
|
+
* @param options - Options for the script.
|
2212
2358
|
* @returns a promise that resolves to the added tag when the script's
|
2213
2359
|
* `onload` event fires or when the script content was injected into the
|
2214
2360
|
* frame.
|
@@ -2218,36 +2364,29 @@ export declare class Frame {
|
|
2218
2364
|
* Adds a `<link rel="stylesheet">` tag into the page with the desired url or
|
2219
2365
|
* a `<style type="text/css">` tag with the content.
|
2220
2366
|
*
|
2221
|
-
* @param options -
|
2222
|
-
*
|
2367
|
+
* @param options - Options for the style link.
|
2223
2368
|
* @returns a promise that resolves to the added tag when the stylesheets's
|
2224
2369
|
* `onload` event fires or when the CSS content was injected into the
|
2225
2370
|
* frame.
|
2226
2371
|
*/
|
2227
|
-
addStyleTag(options: FrameAddStyleTagOptions): Promise<ElementHandle<
|
2372
|
+
addStyleTag(options: FrameAddStyleTagOptions): Promise<ElementHandle<HTMLStyleElement | HTMLLinkElement>>;
|
2228
2373
|
/**
|
2229
|
-
*
|
2230
|
-
* This method clicks the first element found that matches `selector`.
|
2374
|
+
* Clicks the first element found that matches `selector`.
|
2231
2375
|
*
|
2232
2376
|
* @remarks
|
2377
|
+
* If `click()` triggers a navigation event and there's a separate
|
2378
|
+
* `page.waitForNavigation()` promise to be resolved, you may end up with a
|
2379
|
+
* race condition that yields unexpected results. The correct pattern for
|
2380
|
+
* click and wait for navigation is the following:
|
2233
2381
|
*
|
2234
|
-
*
|
2235
|
-
* {@link Page.mouse} to click in the center of the element. If there's no
|
2236
|
-
* element matching `selector`, the method throws an error.
|
2237
|
-
*
|
2238
|
-
* Bear in mind that if `click()` triggers a navigation event and there's a
|
2239
|
-
* separate `page.waitForNavigation()` promise to be resolved, you may end up
|
2240
|
-
* with a race condition that yields unexpected results. The correct pattern
|
2241
|
-
* for click and wait for navigation is the following:
|
2242
|
-
*
|
2243
|
-
* ```javascript
|
2382
|
+
* ```ts
|
2244
2383
|
* const [response] = await Promise.all([
|
2245
2384
|
* page.waitForNavigation(waitOptions),
|
2246
2385
|
* frame.click(selector, clickOptions),
|
2247
2386
|
* ]);
|
2248
2387
|
* ```
|
2249
|
-
*
|
2250
|
-
*
|
2388
|
+
*
|
2389
|
+
* @param selector - The selector to query for.
|
2251
2390
|
*/
|
2252
2391
|
click(selector: string, options?: {
|
2253
2392
|
delay?: number;
|
@@ -2255,60 +2394,44 @@ export declare class Frame {
|
|
2255
2394
|
clickCount?: number;
|
2256
2395
|
}): Promise<void>;
|
2257
2396
|
/**
|
2258
|
-
*
|
2397
|
+
* Focuses the first element that matches the `selector`.
|
2259
2398
|
*
|
2260
|
-
* @
|
2261
|
-
*
|
2262
|
-
*
|
2263
|
-
* @param selector - the selector for the element to focus. If there are
|
2264
|
-
* multiple elements, the first will be focused.
|
2399
|
+
* @param selector - The selector to query for.
|
2400
|
+
* @throws Throws if there's no element matching `selector`.
|
2265
2401
|
*/
|
2266
2402
|
focus(selector: string): Promise<void>;
|
2267
2403
|
/**
|
2268
|
-
*
|
2269
|
-
*
|
2270
|
-
* element.
|
2404
|
+
* Hovers the pointer over the center of the first element that matches the
|
2405
|
+
* `selector`.
|
2271
2406
|
*
|
2272
|
-
* @
|
2273
|
-
*
|
2274
|
-
*
|
2275
|
-
* @param selector - the selector for the element to hover. If there are
|
2276
|
-
* multiple elements, the first will be hovered.
|
2407
|
+
* @param selector - The selector to query for.
|
2408
|
+
* @throws Throws if there's no element matching `selector`.
|
2277
2409
|
*/
|
2278
2410
|
hover(selector: string): Promise<void>;
|
2279
2411
|
/**
|
2280
|
-
*
|
2281
|
-
*
|
2282
|
-
*
|
2283
|
-
* @remarks
|
2284
|
-
*
|
2285
|
-
* If there's no `<select>` element matching `selector`, the
|
2286
|
-
* method throws an error.
|
2412
|
+
* Selects a set of value on the first `<select>` element that matches the
|
2413
|
+
* `selector`.
|
2287
2414
|
*
|
2288
2415
|
* @example
|
2416
|
+
*
|
2289
2417
|
* ```ts
|
2290
2418
|
* frame.select('select#colors', 'blue'); // single selection
|
2291
2419
|
* frame.select('select#colors', 'red', 'green', 'blue'); // multiple selections
|
2292
2420
|
* ```
|
2293
2421
|
*
|
2294
|
-
* @param selector -
|
2295
|
-
* @param values -
|
2422
|
+
* @param selector - The selector to query for.
|
2423
|
+
* @param values - The array of values to select. If the `<select>` has the
|
2296
2424
|
* `multiple` attribute, all values are considered, otherwise only the first
|
2297
2425
|
* one is taken into account.
|
2298
2426
|
* @returns the list of values that were successfully selected.
|
2427
|
+
* @throws Throws if there's no `<select>` matching `selector`.
|
2299
2428
|
*/
|
2300
2429
|
select(selector: string, ...values: string[]): Promise<string[]>;
|
2301
2430
|
/**
|
2302
|
-
*
|
2303
|
-
* needed, and then uses {@link Page.touchscreen} to tap in the center of the
|
2304
|
-
* element.
|
2431
|
+
* Taps the first element that matches the `selector`.
|
2305
2432
|
*
|
2306
|
-
* @
|
2307
|
-
*
|
2308
|
-
* If there's no element matching `selector`, the method throws an error.
|
2309
|
-
*
|
2310
|
-
* @param selector - the selector to tap.
|
2311
|
-
* @returns a promise that resolves when the element has been tapped.
|
2433
|
+
* @param selector - The selector to query for.
|
2434
|
+
* @throws Throws if there's no element matching `selector`.
|
2312
2435
|
*/
|
2313
2436
|
tap(selector: string): Promise<void>;
|
2314
2437
|
/**
|
@@ -2320,6 +2443,7 @@ export declare class Frame {
|
|
2320
2443
|
* {@link Keyboard.press}.
|
2321
2444
|
*
|
2322
2445
|
* @example
|
2446
|
+
*
|
2323
2447
|
* ```ts
|
2324
2448
|
* await frame.type('#mytextarea', 'Hello'); // Types instantly
|
2325
2449
|
* await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user
|
@@ -2330,119 +2454,31 @@ export declare class Frame {
|
|
2330
2454
|
* @param text - text to type into the element
|
2331
2455
|
* @param options - takes one option, `delay`, which sets the time to wait
|
2332
2456
|
* between key presses in milliseconds. Defaults to `0`.
|
2333
|
-
*
|
2334
|
-
* @returns a promise that resolves when the typing is complete.
|
2335
2457
|
*/
|
2336
2458
|
type(selector: string, text: string, options?: {
|
2337
2459
|
delay: number;
|
2338
2460
|
}): Promise<void>;
|
2339
2461
|
/**
|
2462
|
+
* @deprecated Use `new Promise(r => setTimeout(r, milliseconds));`.
|
2463
|
+
*
|
2340
2464
|
* Causes your script to wait for the given number of milliseconds.
|
2341
2465
|
*
|
2342
2466
|
* @remarks
|
2343
2467
|
* It's generally recommended to not wait for a number of seconds, but instead
|
2344
|
-
* use {@link Frame.waitForSelector}, {@link Frame.waitForXPath} or
|
2345
|
-
* {@link Frame.waitForFunction} to wait for exactly the conditions you want.
|
2346
|
-
*
|
2347
|
-
* @example
|
2348
|
-
*
|
2349
|
-
* Wait for 1 second:
|
2350
|
-
*
|
2351
|
-
* ```
|
2352
|
-
* await frame.waitForTimeout(1000);
|
2353
|
-
* ```
|
2354
|
-
*
|
2355
|
-
* @param milliseconds - the number of milliseconds to wait.
|
2356
|
-
*/
|
2357
|
-
waitForTimeout(milliseconds: number): Promise<void>;
|
2358
|
-
/**
|
2359
|
-
* @remarks
|
2360
|
-
*
|
2361
|
-
*
|
2362
|
-
* Wait for the `selector` to appear in page. If at the moment of calling the
|
2363
|
-
* method the `selector` already exists, the method will return immediately.
|
2364
|
-
* If the selector doesn't appear after the `timeout` milliseconds of waiting,
|
2365
|
-
* the function will throw.
|
2366
|
-
*
|
2367
|
-
* This method works across navigations.
|
2368
|
-
*
|
2369
|
-
* @example
|
2370
|
-
* ```ts
|
2371
|
-
* const puppeteer = require('puppeteer');
|
2372
|
-
*
|
2373
|
-
* (async () => {
|
2374
|
-
* const browser = await puppeteer.launch();
|
2375
|
-
* const page = await browser.newPage();
|
2376
|
-
* let currentURL;
|
2377
|
-
* page.mainFrame()
|
2378
|
-
* .waitForSelector('img')
|
2379
|
-
* .then(() => console.log('First URL with image: ' + currentURL));
|
2380
|
-
*
|
2381
|
-
* for (currentURL of ['https://example.com', 'https://google.com', 'https://bbc.com']) {
|
2382
|
-
* await page.goto(currentURL);
|
2383
|
-
* }
|
2384
|
-
* await browser.close();
|
2385
|
-
* })();
|
2386
|
-
* ```
|
2387
|
-
* @param selector - the selector to wait for.
|
2388
|
-
* @param options - options to define if the element should be visible and how
|
2389
|
-
* long to wait before timing out.
|
2390
|
-
* @returns a promise which resolves when an element matching the selector
|
2391
|
-
* string is added to the DOM.
|
2392
|
-
*/
|
2393
|
-
waitForSelector<Selector extends string>(selector: Selector, options?: WaitForSelectorOptions): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
2394
|
-
/**
|
2395
|
-
* @remarks
|
2396
|
-
* Wait for the `xpath` to appear in page. If at the moment of calling the
|
2397
|
-
* method the `xpath` already exists, the method will return immediately. If
|
2398
|
-
* the xpath doesn't appear after the `timeout` milliseconds of waiting, the
|
2399
|
-
* function will throw.
|
2400
|
-
*
|
2401
|
-
* For a code example, see the example for {@link Frame.waitForSelector}. That
|
2402
|
-
* function behaves identically other than taking a CSS selector rather than
|
2403
|
-
* an XPath.
|
2404
|
-
*
|
2405
|
-
* @param xpath - the XPath expression to wait for.
|
2406
|
-
* @param options - options to configure the visiblity of the element and how
|
2407
|
-
* long to wait before timing out.
|
2408
|
-
*/
|
2409
|
-
waitForXPath(xpath: string, options?: WaitForSelectorOptions): Promise<ElementHandle<Node> | null>;
|
2410
|
-
/**
|
2411
|
-
* @remarks
|
2412
|
-
*
|
2413
|
-
* @example
|
2414
|
-
*
|
2415
|
-
* The `waitForFunction` can be used to observe viewport size change:
|
2416
|
-
* ```ts
|
2417
|
-
* const puppeteer = require('puppeteer');
|
2468
|
+
* use {@link Frame.waitForSelector}, {@link Frame.waitForXPath} or
|
2469
|
+
* {@link Frame.waitForFunction} to wait for exactly the conditions you want.
|
2418
2470
|
*
|
2419
|
-
*
|
2420
|
-
* . const browser = await puppeteer.launch();
|
2421
|
-
* . const page = await browser.newPage();
|
2422
|
-
* . const watchDog = page.mainFrame().waitForFunction('window.innerWidth < 100');
|
2423
|
-
* . page.setViewport({width: 50, height: 50});
|
2424
|
-
* . await watchDog;
|
2425
|
-
* . await browser.close();
|
2426
|
-
* })();
|
2427
|
-
* ```
|
2471
|
+
* @example
|
2428
2472
|
*
|
2429
|
-
*
|
2473
|
+
* Wait for 1 second:
|
2430
2474
|
*
|
2431
2475
|
* ```ts
|
2432
|
-
*
|
2433
|
-
* await frame.waitForFunction(
|
2434
|
-
* selector => !!document.querySelector(selector),
|
2435
|
-
* {}, // empty options object
|
2436
|
-
* selector
|
2437
|
-
*);
|
2476
|
+
* await frame.waitForTimeout(1000);
|
2438
2477
|
* ```
|
2439
2478
|
*
|
2440
|
-
* @param
|
2441
|
-
* @param options - options to configure the polling method and timeout.
|
2442
|
-
* @param args - arguments to pass to the `pageFunction`.
|
2443
|
-
* @returns the promise which resolve when the `pageFunction` returns a truthy value.
|
2479
|
+
* @param milliseconds - the number of milliseconds to wait.
|
2444
2480
|
*/
|
2445
|
-
|
2481
|
+
waitForTimeout(milliseconds: number): Promise<void>;
|
2446
2482
|
/**
|
2447
2483
|
* @returns the frame's title.
|
2448
2484
|
*/
|
@@ -2539,11 +2575,11 @@ export declare interface FrameWaitForFunctionOptions {
|
|
2539
2575
|
*/
|
2540
2576
|
export declare interface GeolocationOptions {
|
2541
2577
|
/**
|
2542
|
-
* Latitude between
|
2578
|
+
* Latitude between `-90` and `90`.
|
2543
2579
|
*/
|
2544
2580
|
longitude: number;
|
2545
2581
|
/**
|
2546
|
-
* Longitude between
|
2582
|
+
* Longitude between `-180` and `180`.
|
2547
2583
|
*/
|
2548
2584
|
latitude: number;
|
2549
2585
|
/**
|
@@ -2578,14 +2614,13 @@ export declare type HandleOr<T> = HandleFor<T> | JSHandle<T> | T;
|
|
2578
2614
|
export declare type Handler<T = any> = (event?: T) => void;
|
2579
2615
|
|
2580
2616
|
/**
|
2581
|
-
*
|
2582
2617
|
* Represents an HTTP request sent by a page.
|
2583
2618
|
* @remarks
|
2584
2619
|
*
|
2585
2620
|
* Whenever the page sends a request, such as for a network resource, the
|
2586
2621
|
* following events are emitted by Puppeteer's `page`:
|
2587
2622
|
*
|
2588
|
-
* - `request`:
|
2623
|
+
* - `request`: emitted when the request is issued by the page.
|
2589
2624
|
* - `requestfinished` - emitted when the response body is downloaded and the
|
2590
2625
|
* request is complete.
|
2591
2626
|
*
|
@@ -2645,14 +2680,14 @@ export declare class HTTPRequest {
|
|
2645
2680
|
abortErrorReason(): Protocol.Network.ErrorReason | null;
|
2646
2681
|
/**
|
2647
2682
|
* @returns An InterceptResolutionState object describing the current resolution
|
2648
|
-
*
|
2683
|
+
* action and priority.
|
2649
2684
|
*
|
2650
|
-
*
|
2651
|
-
*
|
2652
|
-
*
|
2685
|
+
* InterceptResolutionState contains:
|
2686
|
+
* action: InterceptResolutionAction
|
2687
|
+
* priority?: number
|
2653
2688
|
*
|
2654
|
-
*
|
2655
|
-
*
|
2689
|
+
* InterceptResolutionAction is one of: `abort`, `respond`, `continue`,
|
2690
|
+
* `disabled`, `none`, or `already-handled`.
|
2656
2691
|
*/
|
2657
2692
|
interceptResolutionState(): InterceptResolutionState;
|
2658
2693
|
/**
|
@@ -2770,6 +2805,7 @@ export declare class HTTPRequest {
|
|
2770
2805
|
* Exception is immediately thrown if the request interception is not enabled.
|
2771
2806
|
*
|
2772
2807
|
* @example
|
2808
|
+
*
|
2773
2809
|
* ```ts
|
2774
2810
|
* await page.setRequestInterception(true);
|
2775
2811
|
* page.on('request', request => {
|
@@ -2800,13 +2836,14 @@ export declare class HTTPRequest {
|
|
2800
2836
|
*
|
2801
2837
|
* @example
|
2802
2838
|
* An example of fulfilling all requests with 404 responses:
|
2839
|
+
*
|
2803
2840
|
* ```ts
|
2804
2841
|
* await page.setRequestInterception(true);
|
2805
2842
|
* page.on('request', request => {
|
2806
2843
|
* request.respond({
|
2807
2844
|
* status: 404,
|
2808
2845
|
* contentType: 'text/plain',
|
2809
|
-
* body: 'Not Found!'
|
2846
|
+
* body: 'Not Found!',
|
2810
2847
|
* });
|
2811
2848
|
* });
|
2812
2849
|
* ```
|
@@ -2864,7 +2901,7 @@ export declare class HTTPResponse {
|
|
2864
2901
|
*/
|
2865
2902
|
status(): number;
|
2866
2903
|
/**
|
2867
|
-
* @returns
|
2904
|
+
* @returns The status text of the response (e.g. usually an "OK" for a
|
2868
2905
|
* success).
|
2869
2906
|
*/
|
2870
2907
|
statusText(): string;
|
@@ -2969,14 +3006,14 @@ export declare class HTTPResponse {
|
|
2969
3006
|
|
2970
3007
|
/* Excluded from this release type: InternalQueryHandler */
|
2971
3008
|
|
2972
|
-
/* Excluded from this release type: isErrnoException */
|
2973
|
-
|
2974
|
-
/* Excluded from this release type: isErrorLike */
|
2975
|
-
|
2976
3009
|
/* Excluded from this release type: isNode */
|
2977
3010
|
|
2978
3011
|
/* Excluded from this release type: isNumber */
|
2979
3012
|
|
3013
|
+
/* Excluded from this release type: IsolatedWorld */
|
3014
|
+
|
3015
|
+
/* Excluded from this release type: IsolatedWorldChart */
|
3016
|
+
|
2980
3017
|
/* Excluded from this release type: IsPageTargetCallback */
|
2981
3018
|
|
2982
3019
|
/* Excluded from this release type: isString */
|
@@ -3026,21 +3063,24 @@ export declare class HTTPResponse {
|
|
3026
3063
|
}
|
3027
3064
|
|
3028
3065
|
/**
|
3029
|
-
* Represents
|
3030
|
-
* {@link Page.evaluateHandle
|
3066
|
+
* Represents a reference to a JavaScript object. Instances can be created using
|
3067
|
+
* {@link Page.evaluateHandle}.
|
3068
|
+
*
|
3069
|
+
* Handles prevent the referenced JavaScript object from being garbage-collected
|
3070
|
+
* unless the handle is purposely {@link JSHandle.dispose | disposed}. JSHandles
|
3071
|
+
* are auto-disposed when their associated frame is navigated away or the parent
|
3072
|
+
* context gets destroyed.
|
3073
|
+
*
|
3074
|
+
* Handles can be used as arguments for any evaluation function such as
|
3075
|
+
* {@link Page.$eval}, {@link Page.evaluate}, and {@link Page.evaluateHandle}.
|
3076
|
+
* They are resolved to their referenced object.
|
3031
3077
|
*
|
3032
3078
|
* @example
|
3079
|
+
*
|
3033
3080
|
* ```ts
|
3034
3081
|
* const windowHandle = await page.evaluateHandle(() => window);
|
3035
3082
|
* ```
|
3036
3083
|
*
|
3037
|
-
* JSHandle prevents the referenced JavaScript object from being garbage-collected
|
3038
|
-
* unless the handle is {@link JSHandle.dispose | disposed}. JSHandles are auto-
|
3039
|
-
* disposed when their origin frame gets navigated or the parent context gets destroyed.
|
3040
|
-
*
|
3041
|
-
* JSHandle instances can be used as arguments for {@link Page.$eval},
|
3042
|
-
* {@link Page.evaluate}, and {@link Page.evaluateHandle}.
|
3043
|
-
*
|
3044
3084
|
* @public
|
3045
3085
|
*/
|
3046
3086
|
export declare class JSHandle<T = unknown> {
|
@@ -3049,43 +3089,26 @@ export declare class HTTPResponse {
|
|
3049
3089
|
* Used for nominally typing {@link JSHandle}.
|
3050
3090
|
*/
|
3051
3091
|
[__JSHandleSymbol]?: T;
|
3052
|
-
/* Excluded from this release type:
|
3053
|
-
/* Excluded from this release type:
|
3054
|
-
/* Excluded from this release type: _remoteObject */
|
3055
|
-
/* Excluded from this release type: _context */
|
3092
|
+
/* Excluded from this release type: client */
|
3093
|
+
/* Excluded from this release type: disposed */
|
3056
3094
|
/* Excluded from this release type: __constructor */
|
3057
|
-
/**
|
3095
|
+
/**
|
3096
|
+
* @returns The execution context the handle belongs to.
|
3058
3097
|
*/
|
3059
3098
|
executionContext(): ExecutionContext;
|
3060
3099
|
/**
|
3061
|
-
*
|
3062
|
-
* `pageFunction` returns a Promise, then `handle.evaluate` would wait for the
|
3063
|
-
* promise to resolve and return its value.
|
3100
|
+
* Evaluates the given function with the current handle as its first argument.
|
3064
3101
|
*
|
3065
|
-
* @
|
3066
|
-
* ```ts
|
3067
|
-
* const tweetHandle = await page.$('.tweet .retweets');
|
3068
|
-
* expect(await tweetHandle.evaluate(node => node.innerText)).toBe('10');
|
3069
|
-
* ```
|
3102
|
+
* @see {@link ExecutionContext.evaluate} for more details.
|
3070
3103
|
*/
|
3071
3104
|
evaluate<Params extends unknown[], Func extends EvaluateFunc<[this, ...Params]> = EvaluateFunc<[
|
3072
3105
|
this,
|
3073
3106
|
...Params
|
3074
3107
|
]>>(pageFunction: Func | string, ...args: Params): Promise<Awaited<ReturnType<Func>>>;
|
3075
3108
|
/**
|
3076
|
-
*
|
3077
|
-
*
|
3078
|
-
* @remarks
|
3079
|
-
*
|
3080
|
-
* The only difference between `jsHandle.evaluate` and
|
3081
|
-
* `jsHandle.evaluateHandle` is that `jsHandle.evaluateHandle` returns an
|
3082
|
-
* in-page object (JSHandle).
|
3083
|
-
*
|
3084
|
-
* If the function passed to `jsHandle.evaluateHandle` returns a Promise, then
|
3085
|
-
* `evaluateHandle.evaluateHandle` waits for the promise to resolve and
|
3086
|
-
* returns its value.
|
3109
|
+
* Evaluates the given function with the current handle as its first argument.
|
3087
3110
|
*
|
3088
|
-
*
|
3111
|
+
* @see {@link ExecutionContext.evaluateHandle} for more details.
|
3089
3112
|
*/
|
3090
3113
|
evaluateHandle<Params extends unknown[], Func extends EvaluateFunc<[this, ...Params]> = EvaluateFunc<[
|
3091
3114
|
this,
|
@@ -3097,51 +3120,53 @@ export declare class HTTPResponse {
|
|
3097
3120
|
getProperty<K extends keyof T>(propertyName: HandleOr<K>): Promise<HandleFor<T[K]>>;
|
3098
3121
|
getProperty(propertyName: string): Promise<JSHandle<unknown>>;
|
3099
3122
|
/**
|
3100
|
-
*
|
3101
|
-
* for the property values.
|
3123
|
+
* Gets a map of handles representing the properties of the current handle.
|
3102
3124
|
*
|
3103
3125
|
* @example
|
3126
|
+
*
|
3104
3127
|
* ```ts
|
3105
3128
|
* const listHandle = await page.evaluateHandle(() => document.body.children);
|
3106
3129
|
* const properties = await listHandle.getProperties();
|
3107
3130
|
* const children = [];
|
3108
3131
|
* for (const property of properties.values()) {
|
3109
3132
|
* const element = property.asElement();
|
3110
|
-
* if (element)
|
3133
|
+
* if (element) {
|
3111
3134
|
* children.push(element);
|
3135
|
+
* }
|
3112
3136
|
* }
|
3113
3137
|
* children; // holds elementHandles to all children of document.body
|
3114
3138
|
* ```
|
3115
3139
|
*/
|
3116
3140
|
getProperties(): Promise<Map<string, JSHandle>>;
|
3117
3141
|
/**
|
3118
|
-
* @returns
|
3119
|
-
*
|
3120
|
-
* @
|
3142
|
+
* @returns A vanilla object representing the serializable portions of the
|
3143
|
+
* referenced object.
|
3144
|
+
* @throws Throws if the object cannot be serialized due to circularity.
|
3121
3145
|
*
|
3122
|
-
*
|
3123
|
-
*
|
3124
|
-
* **NOTE** The method throws if the referenced object is not stringifiable.
|
3146
|
+
* @remarks
|
3147
|
+
* If the object has a `toJSON` function, it **will not** be called.
|
3125
3148
|
*/
|
3126
|
-
jsonValue
|
3149
|
+
jsonValue(): Promise<T>;
|
3127
3150
|
/**
|
3128
|
-
* @returns Either `null` or the
|
3129
|
-
*
|
3151
|
+
* @returns Either `null` or the handle itself if the handle is an
|
3152
|
+
* instance of {@link ElementHandle}.
|
3130
3153
|
*/
|
3131
3154
|
asElement(): ElementHandle<Node> | null;
|
3132
3155
|
/**
|
3133
|
-
*
|
3134
|
-
* successfully disposed of.
|
3156
|
+
* Releases the object referenced by the handle for garbage collection.
|
3135
3157
|
*/
|
3136
3158
|
dispose(): Promise<void>;
|
3137
3159
|
/**
|
3138
3160
|
* Returns a string representation of the JSHandle.
|
3139
3161
|
*
|
3140
|
-
* @remarks
|
3162
|
+
* @remarks
|
3163
|
+
* Useful during debugging.
|
3141
3164
|
*/
|
3142
3165
|
toString(): string;
|
3143
3166
|
/**
|
3144
|
-
* Provides access to
|
3167
|
+
* Provides access to the
|
3168
|
+
* [Protocol.Runtime.RemoteObject](https://chromedevtools.github.io/devtools-protocol/tot/Runtime/#type-RemoteObject)
|
3169
|
+
* backing this handle.
|
3145
3170
|
*/
|
3146
3171
|
remoteObject(): Protocol.Runtime.RemoteObject;
|
3147
3172
|
}
|
@@ -3162,6 +3187,7 @@ export declare class HTTPResponse {
|
|
3162
3187
|
*
|
3163
3188
|
* @example
|
3164
3189
|
* An example of holding down `Shift` in order to select and delete some text:
|
3190
|
+
*
|
3165
3191
|
* ```ts
|
3166
3192
|
* await page.keyboard.type('Hello World!');
|
3167
3193
|
* await page.keyboard.press('ArrowLeft');
|
@@ -3177,6 +3203,7 @@ export declare class HTTPResponse {
|
|
3177
3203
|
*
|
3178
3204
|
* @example
|
3179
3205
|
* An example of pressing `A`
|
3206
|
+
*
|
3180
3207
|
* ```ts
|
3181
3208
|
* await page.keyboard.down('Shift');
|
3182
3209
|
* await page.keyboard.press('KeyA');
|
@@ -3234,6 +3261,7 @@ export declare class HTTPResponse {
|
|
3234
3261
|
* Holding down `Shift` will not type the text in upper case.
|
3235
3262
|
*
|
3236
3263
|
* @example
|
3264
|
+
*
|
3237
3265
|
* ```ts
|
3238
3266
|
* page.keyboard.sendCharacter('嗨');
|
3239
3267
|
* ```
|
@@ -3254,6 +3282,7 @@ export declare class HTTPResponse {
|
|
3254
3282
|
* Holding down `Shift` will not type the text in upper case.
|
3255
3283
|
*
|
3256
3284
|
* @example
|
3285
|
+
*
|
3257
3286
|
* ```ts
|
3258
3287
|
* await page.keyboard.type('Hello'); // Types instantly
|
3259
3288
|
* await page.keyboard.type('World', {delay: 100}); // Types slower, like a user
|
@@ -3392,6 +3421,8 @@ export declare class HTTPResponse {
|
|
3392
3421
|
*/
|
3393
3422
|
export declare type LowerCasePaperFormat = 'letter' | 'legal' | 'tabloid' | 'ledger' | 'a0' | 'a1' | 'a2' | 'a3' | 'a4' | 'a5' | 'a6';
|
3394
3423
|
|
3424
|
+
/* Excluded from this release type: MAIN_WORLD */
|
3425
|
+
|
3395
3426
|
/* Excluded from this release type: makePredicateString */
|
3396
3427
|
|
3397
3428
|
/**
|
@@ -3428,6 +3459,7 @@ export declare class HTTPResponse {
|
|
3428
3459
|
* Every `page` object has its own Mouse, accessible with [`page.mouse`](#pagemouse).
|
3429
3460
|
*
|
3430
3461
|
* @example
|
3462
|
+
*
|
3431
3463
|
* ```ts
|
3432
3464
|
* // Using ‘page.mouse’ to trace a 100x100 square.
|
3433
3465
|
* await page.mouse.move(0, 0);
|
@@ -3448,17 +3480,24 @@ export declare class HTTPResponse {
|
|
3448
3480
|
*
|
3449
3481
|
* @example
|
3450
3482
|
* For example, if you want to select all content between nodes:
|
3483
|
+
*
|
3451
3484
|
* ```ts
|
3452
|
-
* await page.evaluate(
|
3453
|
-
*
|
3454
|
-
*
|
3455
|
-
*
|
3456
|
-
*
|
3457
|
-
*
|
3458
|
-
*
|
3459
|
-
*
|
3485
|
+
* await page.evaluate(
|
3486
|
+
* (from, to) => {
|
3487
|
+
* const selection = from.getRootNode().getSelection();
|
3488
|
+
* const range = document.createRange();
|
3489
|
+
* range.setStartBefore(from);
|
3490
|
+
* range.setEndAfter(to);
|
3491
|
+
* selection.removeAllRanges();
|
3492
|
+
* selection.addRange(range);
|
3493
|
+
* },
|
3494
|
+
* fromJSHandle,
|
3495
|
+
* toJSHandle
|
3496
|
+
* );
|
3460
3497
|
* ```
|
3498
|
+
*
|
3461
3499
|
* If you then would want to copy-paste your selection, you can use the clipboard api:
|
3500
|
+
*
|
3462
3501
|
* ```ts
|
3463
3502
|
* // The clipboard api does not allow you to copy, unless the tab is focused.
|
3464
3503
|
* await page.bringToFront();
|
@@ -3469,13 +3508,19 @@ export declare class HTTPResponse {
|
|
3469
3508
|
* return navigator.clipboard.readText();
|
3470
3509
|
* });
|
3471
3510
|
* ```
|
3511
|
+
*
|
3472
3512
|
* **Note**: If you want access to the clipboard API,
|
3473
3513
|
* you have to give it permission to do so:
|
3514
|
+
*
|
3474
3515
|
* ```ts
|
3475
|
-
* await browser
|
3476
|
-
*
|
3477
|
-
*
|
3516
|
+
* await browser
|
3517
|
+
* .defaultBrowserContext()
|
3518
|
+
* .overridePermissions('<your origin>', [
|
3519
|
+
* 'clipboard-read',
|
3520
|
+
* 'clipboard-write',
|
3521
|
+
* ]);
|
3478
3522
|
* ```
|
3523
|
+
*
|
3479
3524
|
* @public
|
3480
3525
|
*/
|
3481
3526
|
export declare class Mouse {
|
@@ -3516,8 +3561,11 @@ export declare class HTTPResponse {
|
|
3516
3561
|
*
|
3517
3562
|
* @example
|
3518
3563
|
* An example of zooming into an element:
|
3564
|
+
*
|
3519
3565
|
* ```ts
|
3520
|
-
* await page.goto(
|
3566
|
+
* await page.goto(
|
3567
|
+
* 'https://mdn.mozillademos.org/en-US/docs/Web/API/Element/wheel_event$samples/Scaling_an_element_via_the_wheel?revision=1587366'
|
3568
|
+
* );
|
3521
3569
|
*
|
3522
3570
|
* const elem = await page.$('div');
|
3523
3571
|
* const boundingBox = await elem.boundingBox();
|
@@ -3526,7 +3574,7 @@ export declare class HTTPResponse {
|
|
3526
3574
|
* boundingBox.y + boundingBox.height / 2
|
3527
3575
|
* );
|
3528
3576
|
*
|
3529
|
-
* await page.mouse.wheel({
|
3577
|
+
* await page.mouse.wheel({deltaY: -100});
|
3530
3578
|
* ```
|
3531
3579
|
*/
|
3532
3580
|
wheel(options?: MouseWheelOptions): Promise<void>;
|
@@ -3670,6 +3718,7 @@ export declare class HTTPResponse {
|
|
3670
3718
|
*
|
3671
3719
|
* @example
|
3672
3720
|
* This example creates a page, navigates it to a URL, and then saves a screenshot:
|
3721
|
+
*
|
3673
3722
|
* ```ts
|
3674
3723
|
* const puppeteer = require('puppeteer');
|
3675
3724
|
*
|
@@ -3687,6 +3736,7 @@ export declare class HTTPResponse {
|
|
3687
3736
|
*
|
3688
3737
|
* @example
|
3689
3738
|
* This example logs a message for a single page `load` event:
|
3739
|
+
*
|
3690
3740
|
* ```ts
|
3691
3741
|
* page.once('load', () => console.log('Page loaded!'));
|
3692
3742
|
* ```
|
@@ -3751,9 +3801,9 @@ export declare class HTTPResponse {
|
|
3751
3801
|
*
|
3752
3802
|
* ```ts
|
3753
3803
|
* const [fileChooser] = await Promise.all([
|
3754
|
-
*
|
3755
|
-
*
|
3756
|
-
*
|
3804
|
+
* page.waitForFileChooser(),
|
3805
|
+
* page.click('#upload-file-button'),
|
3806
|
+
* // some button that triggers file selection
|
3757
3807
|
* ]);
|
3758
3808
|
* await fileChooser.accept(['/tmp/myfile.pdf']);
|
3759
3809
|
* ```
|
@@ -3761,10 +3811,13 @@ export declare class HTTPResponse {
|
|
3761
3811
|
waitForFileChooser(options?: WaitTimeoutOptions): Promise<FileChooser>;
|
3762
3812
|
/**
|
3763
3813
|
* Sets the page's geolocation.
|
3814
|
+
*
|
3764
3815
|
* @remarks
|
3765
|
-
*
|
3816
|
+
* Consider using {@link BrowserContext.overridePermissions} to grant
|
3766
3817
|
* permissions for the page to read its geolocation.
|
3818
|
+
*
|
3767
3819
|
* @example
|
3820
|
+
*
|
3768
3821
|
* ```ts
|
3769
3822
|
* await page.setGeolocation({latitude: 59.95, longitude: 30.31667});
|
3770
3823
|
* ```
|
@@ -3785,6 +3838,7 @@ export declare class HTTPResponse {
|
|
3785
3838
|
browserContext(): BrowserContext;
|
3786
3839
|
/**
|
3787
3840
|
* @returns The page's main frame.
|
3841
|
+
*
|
3788
3842
|
* @remarks
|
3789
3843
|
* Page is guaranteed to have a main frame which persists during navigations.
|
3790
3844
|
*/
|
@@ -3799,27 +3853,31 @@ export declare class HTTPResponse {
|
|
3799
3853
|
*/
|
3800
3854
|
frames(): Frame[];
|
3801
3855
|
/**
|
3802
|
-
* @returns all of the dedicated
|
3803
|
-
*
|
3804
|
-
* WebWorkers}
|
3805
|
-
*
|
3856
|
+
* @returns all of the dedicated {@link
|
3857
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API |
|
3858
|
+
* WebWorkers} associated with the page.
|
3859
|
+
*
|
3806
3860
|
* @remarks
|
3807
|
-
*
|
3861
|
+
* This does not contain ServiceWorkers
|
3808
3862
|
*/
|
3809
3863
|
workers(): WebWorker[];
|
3810
3864
|
/**
|
3811
|
-
* @param value - Whether to enable request interception.
|
3812
|
-
*
|
3813
|
-
* @remarks
|
3814
3865
|
* Activating request interception enables {@link HTTPRequest.abort},
|
3815
|
-
* {@link HTTPRequest.continue} and {@link HTTPRequest.respond} methods.
|
3866
|
+
* {@link HTTPRequest.continue} and {@link HTTPRequest.respond} methods. This
|
3816
3867
|
* provides the capability to modify network requests that are made by a page.
|
3817
3868
|
*
|
3818
3869
|
* Once request interception is enabled, every request will stall unless it's
|
3819
3870
|
* continued, responded or aborted; or completed using the browser cache.
|
3820
3871
|
*
|
3872
|
+
* Enabling request interception disables page caching.
|
3873
|
+
*
|
3874
|
+
* See the
|
3875
|
+
* {@link https://pptr.dev/next/guides/request-interception|Request interception guide}
|
3876
|
+
* for more details.
|
3877
|
+
*
|
3821
3878
|
* @example
|
3822
3879
|
* An example of a naïve request interceptor that aborts all image requests:
|
3880
|
+
*
|
3823
3881
|
* ```ts
|
3824
3882
|
* const puppeteer = require('puppeteer');
|
3825
3883
|
* (async () => {
|
@@ -3827,17 +3885,19 @@ export declare class HTTPResponse {
|
|
3827
3885
|
* const page = await browser.newPage();
|
3828
3886
|
* await page.setRequestInterception(true);
|
3829
3887
|
* page.on('request', interceptedRequest => {
|
3830
|
-
* if (
|
3831
|
-
*
|
3888
|
+
* if (
|
3889
|
+
* interceptedRequest.url().endsWith('.png') ||
|
3890
|
+
* interceptedRequest.url().endsWith('.jpg')
|
3891
|
+
* )
|
3832
3892
|
* interceptedRequest.abort();
|
3833
|
-
* else
|
3834
|
-
*
|
3835
|
-
* });
|
3893
|
+
* else interceptedRequest.continue();
|
3894
|
+
* });
|
3836
3895
|
* await page.goto('https://example.com');
|
3837
3896
|
* await browser.close();
|
3838
3897
|
* })();
|
3839
3898
|
* ```
|
3840
|
-
*
|
3899
|
+
*
|
3900
|
+
* @param value - Whether to enable request interception.
|
3841
3901
|
*/
|
3842
3902
|
setRequestInterception(value: boolean): Promise<void>;
|
3843
3903
|
/**
|
@@ -3845,7 +3905,7 @@ export declare class HTTPResponse {
|
|
3845
3905
|
*
|
3846
3906
|
* @remarks
|
3847
3907
|
* Activating drag interception enables the `Input.drag`,
|
3848
|
-
* methods
|
3908
|
+
* methods This provides the capability to capture drag events emitted
|
3849
3909
|
* on the page, which can then be used to simulate drag-and-drop.
|
3850
3910
|
*/
|
3851
3911
|
setDragInterception(enabled: boolean): Promise<void>;
|
@@ -3860,19 +3920,21 @@ export declare class HTTPResponse {
|
|
3860
3920
|
/**
|
3861
3921
|
* @param networkConditions - Passing `null` disables network condition emulation.
|
3862
3922
|
* @example
|
3923
|
+
*
|
3863
3924
|
* ```ts
|
3864
3925
|
* const puppeteer = require('puppeteer');
|
3865
3926
|
* const slow3G = puppeteer.networkConditions['Slow 3G'];
|
3866
3927
|
*
|
3867
3928
|
* (async () => {
|
3868
|
-
*
|
3869
|
-
*
|
3870
|
-
*
|
3871
|
-
*
|
3872
|
-
*
|
3873
|
-
*
|
3929
|
+
* const browser = await puppeteer.launch();
|
3930
|
+
* const page = await browser.newPage();
|
3931
|
+
* await page.emulateNetworkConditions(slow3G);
|
3932
|
+
* await page.goto('https://www.google.com');
|
3933
|
+
* // other actions...
|
3934
|
+
* await browser.close();
|
3874
3935
|
* })();
|
3875
3936
|
* ```
|
3937
|
+
*
|
3876
3938
|
* @remarks
|
3877
3939
|
* NOTE: This does not affect WebSockets and WebRTC PeerConnections (see
|
3878
3940
|
* https://crbug.com/563644). To set the page offline, you can use
|
@@ -3894,7 +3956,7 @@ export declare class HTTPResponse {
|
|
3894
3956
|
* - {@link Page.setContent | page.setContent(html,options)}
|
3895
3957
|
*
|
3896
3958
|
* - {@link Page.waitForNavigation | page.waitForNavigation(options)}
|
3897
|
-
*
|
3959
|
+
* @param timeout - Maximum navigation time in milliseconds.
|
3898
3960
|
*/
|
3899
3961
|
setDefaultNavigationTimeout(timeout: number): void;
|
3900
3962
|
/**
|
@@ -3932,15 +3994,20 @@ export declare class HTTPResponse {
|
|
3932
3994
|
* recommended as they are easier to debug and use with TypeScript):
|
3933
3995
|
*
|
3934
3996
|
* @example
|
3997
|
+
*
|
3935
3998
|
* ```ts
|
3936
|
-
* const aHandle = await page.evaluateHandle('document')
|
3999
|
+
* const aHandle = await page.evaluateHandle('document');
|
3937
4000
|
* ```
|
3938
4001
|
*
|
3939
4002
|
* @example
|
3940
4003
|
* {@link JSHandle} instances can be passed as arguments to the `pageFunction`:
|
4004
|
+
*
|
3941
4005
|
* ```ts
|
3942
4006
|
* const aHandle = await page.evaluateHandle(() => document.body);
|
3943
|
-
* const resultHandle = await page.evaluateHandle(
|
4007
|
+
* const resultHandle = await page.evaluateHandle(
|
4008
|
+
* body => body.innerHTML,
|
4009
|
+
* aHandle
|
4010
|
+
* );
|
3944
4011
|
* console.log(await resultHandle.jsonValue());
|
3945
4012
|
* await resultHandle.dispose();
|
3946
4013
|
* ```
|
@@ -3950,14 +4017,17 @@ export declare class HTTPResponse {
|
|
3950
4017
|
* you instead get an {@link ElementHandle} back:
|
3951
4018
|
*
|
3952
4019
|
* @example
|
4020
|
+
*
|
3953
4021
|
* ```ts
|
3954
|
-
* const button = await page.evaluateHandle(() =>
|
4022
|
+
* const button = await page.evaluateHandle(() =>
|
4023
|
+
* document.querySelector('button')
|
4024
|
+
* );
|
3955
4025
|
* // can call `click` because `button` is an `ElementHandle`
|
3956
4026
|
* await button.click();
|
3957
4027
|
* ```
|
3958
4028
|
*
|
3959
4029
|
* The TypeScript definitions assume that `evaluateHandle` returns
|
3960
|
-
*
|
4030
|
+
* a `JSHandle`, but if you know it's going to return an
|
3961
4031
|
* `ElementHandle`, pass it as the generic argument:
|
3962
4032
|
*
|
3963
4033
|
* ```ts
|
@@ -3981,7 +4051,7 @@ export declare class HTTPResponse {
|
|
3981
4051
|
*
|
3982
4052
|
* ```ts
|
3983
4053
|
* // Create a Map object
|
3984
|
-
* await page.evaluate(() => window.map = new Map());
|
4054
|
+
* await page.evaluate(() => (window.map = new Map()));
|
3985
4055
|
* // Get a handle to the Map object prototype
|
3986
4056
|
* const mapPrototype = await page.evaluateHandle(() => Map.prototype);
|
3987
4057
|
* // Query all map instances into an array
|
@@ -3991,6 +4061,7 @@ export declare class HTTPResponse {
|
|
3991
4061
|
* await mapInstances.dispose();
|
3992
4062
|
* await mapPrototype.dispose();
|
3993
4063
|
* ```
|
4064
|
+
*
|
3994
4065
|
* @param prototypeHandle - a handle to the object prototype.
|
3995
4066
|
* @returns Promise which resolves to a handle to an array of objects with
|
3996
4067
|
* this prototype.
|
@@ -4025,7 +4096,10 @@ export declare class HTTPResponse {
|
|
4025
4096
|
* ```ts
|
4026
4097
|
* // if you don't provide HTMLInputElement here, TS will error
|
4027
4098
|
* // as `value` is not on `Element`
|
4028
|
-
* const searchValue = await page.$eval(
|
4099
|
+
* const searchValue = await page.$eval(
|
4100
|
+
* '#search',
|
4101
|
+
* (el: HTMLInputElement) => el.value
|
4102
|
+
* );
|
4029
4103
|
* ```
|
4030
4104
|
*
|
4031
4105
|
* The compiler should be able to infer the return type
|
@@ -4038,7 +4112,8 @@ export declare class HTTPResponse {
|
|
4038
4112
|
* // The compiler can infer the return type in this case, but if it can't
|
4039
4113
|
* // or if you want to be more explicit, provide it as the generic type.
|
4040
4114
|
* const searchValue = await page.$eval<string>(
|
4041
|
-
*
|
4115
|
+
* '#search',
|
4116
|
+
* (el: HTMLInputElement) => el.value
|
4042
4117
|
* );
|
4043
4118
|
* ```
|
4044
4119
|
*
|
@@ -4063,7 +4138,6 @@ export declare class HTTPResponse {
|
|
4063
4138
|
* the page and passes the result as the first argument to the `pageFunction`.
|
4064
4139
|
*
|
4065
4140
|
* @remarks
|
4066
|
-
*
|
4067
4141
|
* If `pageFunction` returns a promise `$$eval` will wait for the promise to
|
4068
4142
|
* resolve and then return its value.
|
4069
4143
|
*
|
@@ -4075,7 +4149,7 @@ export declare class HTTPResponse {
|
|
4075
4149
|
*
|
4076
4150
|
* // get the text content of all the `.options` elements:
|
4077
4151
|
* const options = await page.$$eval('div > span.options', options => {
|
4078
|
-
* return options.map(option => option.textContent)
|
4152
|
+
* return options.map(option => option.textContent);
|
4079
4153
|
* });
|
4080
4154
|
* ```
|
4081
4155
|
*
|
@@ -4104,16 +4178,17 @@ export declare class HTTPResponse {
|
|
4104
4178
|
* // The compiler can infer the return type in this case, but if it can't
|
4105
4179
|
* // or if you want to be more explicit, provide it as the generic type.
|
4106
4180
|
* const allInputValues = await page.$$eval<string[]>(
|
4107
|
-
*
|
4181
|
+
* 'input',
|
4182
|
+
* (elements: HTMLInputElement[]) => elements.map(e => e.textContent)
|
4108
4183
|
* );
|
4109
4184
|
* ```
|
4110
4185
|
*
|
4111
4186
|
* @param selector - the
|
4112
4187
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
4113
4188
|
* to query for
|
4114
|
-
* @param pageFunction - the function to be evaluated in the page context.
|
4115
|
-
* be passed the result of
|
4116
|
-
* as its first argument.
|
4189
|
+
* @param pageFunction - the function to be evaluated in the page context.
|
4190
|
+
* Will be passed the result of
|
4191
|
+
* `Array.from(document.querySelectorAll(selector))` as its first argument.
|
4117
4192
|
* @param args - any additional arguments to pass through to `pageFunction`.
|
4118
4193
|
*
|
4119
4194
|
* @returns The result of calling `pageFunction`. If it returns an element it
|
@@ -4128,8 +4203,10 @@ export declare class HTTPResponse {
|
|
4128
4203
|
* The method evaluates the XPath expression relative to the page document as
|
4129
4204
|
* its context node. If there are no such elements, the method resolves to an
|
4130
4205
|
* empty array.
|
4206
|
+
*
|
4131
4207
|
* @remarks
|
4132
4208
|
* Shortcut for {@link Frame.$x | Page.mainFrame().$x(expression) }.
|
4209
|
+
*
|
4133
4210
|
* @param expression - Expression to evaluate
|
4134
4211
|
*/
|
4135
4212
|
$x(expression: string): Promise<Array<ElementHandle<Node>>>;
|
@@ -4141,6 +4218,7 @@ export declare class HTTPResponse {
|
|
4141
4218
|
deleteCookie(...cookies: Protocol.Network.DeleteCookiesRequest[]): Promise<void>;
|
4142
4219
|
/**
|
4143
4220
|
* @example
|
4221
|
+
*
|
4144
4222
|
* ```ts
|
4145
4223
|
* await page.setCookie(cookieObject1, cookieObject2);
|
4146
4224
|
* ```
|
@@ -4148,10 +4226,13 @@ export declare class HTTPResponse {
|
|
4148
4226
|
setCookie(...cookies: Protocol.Network.CookieParam[]): Promise<void>;
|
4149
4227
|
/**
|
4150
4228
|
* Adds a `<script>` tag into the page with the desired URL or content.
|
4229
|
+
*
|
4151
4230
|
* @remarks
|
4152
|
-
* Shortcut for
|
4153
|
-
* @
|
4154
|
-
*
|
4231
|
+
* Shortcut for
|
4232
|
+
* {@link Frame.addScriptTag | page.mainFrame().addScriptTag(options)}.
|
4233
|
+
*
|
4234
|
+
* @returns Promise which resolves to the added tag when the script's onload
|
4235
|
+
* fires or when the script content was injected into frame.
|
4155
4236
|
*/
|
4156
4237
|
addScriptTag(options: {
|
4157
4238
|
url?: string;
|
@@ -4172,81 +4253,104 @@ export declare class HTTPResponse {
|
|
4172
4253
|
content?: string;
|
4173
4254
|
}): Promise<ElementHandle<Node>>;
|
4174
4255
|
/**
|
4175
|
-
* The method adds a function called `name` on the page's `window` object.
|
4176
|
-
* called, the function executes `puppeteerFunction` in node.js and
|
4177
|
-
* `Promise` which resolves to the return value of
|
4256
|
+
* The method adds a function called `name` on the page's `window` object.
|
4257
|
+
* When called, the function executes `puppeteerFunction` in node.js and
|
4258
|
+
* returns a `Promise` which resolves to the return value of
|
4259
|
+
* `puppeteerFunction`.
|
4178
4260
|
*
|
4179
4261
|
* If the puppeteerFunction returns a `Promise`, it will be awaited.
|
4180
4262
|
*
|
4181
|
-
*
|
4182
|
-
*
|
4183
|
-
*
|
4184
|
-
*
|
4263
|
+
* :::note
|
4264
|
+
*
|
4265
|
+
* Functions installed via `page.exposeFunction` survive navigations.
|
4266
|
+
*
|
4267
|
+
* :::note
|
4268
|
+
*
|
4185
4269
|
* @example
|
4186
4270
|
* An example of adding an `md5` function into the page:
|
4271
|
+
*
|
4187
4272
|
* ```ts
|
4188
4273
|
* const puppeteer = require('puppeteer');
|
4189
4274
|
* const crypto = require('crypto');
|
4190
4275
|
*
|
4191
4276
|
* (async () => {
|
4192
|
-
*
|
4193
|
-
*
|
4194
|
-
*
|
4195
|
-
*
|
4196
|
-
*
|
4197
|
-
*
|
4198
|
-
*
|
4199
|
-
*
|
4200
|
-
*
|
4201
|
-
*
|
4202
|
-
*
|
4203
|
-
*
|
4204
|
-
*
|
4277
|
+
* const browser = await puppeteer.launch();
|
4278
|
+
* const page = await browser.newPage();
|
4279
|
+
* page.on('console', msg => console.log(msg.text()));
|
4280
|
+
* await page.exposeFunction('md5', text =>
|
4281
|
+
* crypto.createHash('md5').update(text).digest('hex')
|
4282
|
+
* );
|
4283
|
+
* await page.evaluate(async () => {
|
4284
|
+
* // use window.md5 to compute hashes
|
4285
|
+
* const myString = 'PUPPETEER';
|
4286
|
+
* const myHash = await window.md5(myString);
|
4287
|
+
* console.log(`md5 of ${myString} is ${myHash}`);
|
4288
|
+
* });
|
4289
|
+
* await browser.close();
|
4205
4290
|
* })();
|
4206
4291
|
* ```
|
4292
|
+
*
|
4293
|
+
* @example
|
4207
4294
|
* An example of adding a `window.readfile` function into the page:
|
4295
|
+
*
|
4208
4296
|
* ```ts
|
4209
4297
|
* const puppeteer = require('puppeteer');
|
4210
4298
|
* const fs = require('fs');
|
4211
4299
|
*
|
4212
4300
|
* (async () => {
|
4213
|
-
*
|
4214
|
-
*
|
4215
|
-
*
|
4216
|
-
*
|
4217
|
-
*
|
4218
|
-
*
|
4219
|
-
*
|
4220
|
-
*
|
4221
|
-
*
|
4222
|
-
*
|
4223
|
-
*
|
4224
|
-
*
|
4225
|
-
*
|
4226
|
-
*
|
4227
|
-
*
|
4228
|
-
*
|
4229
|
-
*
|
4301
|
+
* const browser = await puppeteer.launch();
|
4302
|
+
* const page = await browser.newPage();
|
4303
|
+
* page.on('console', msg => console.log(msg.text()));
|
4304
|
+
* await page.exposeFunction('readfile', async filePath => {
|
4305
|
+
* return new Promise((resolve, reject) => {
|
4306
|
+
* fs.readFile(filePath, 'utf8', (err, text) => {
|
4307
|
+
* if (err) reject(err);
|
4308
|
+
* else resolve(text);
|
4309
|
+
* });
|
4310
|
+
* });
|
4311
|
+
* });
|
4312
|
+
* await page.evaluate(async () => {
|
4313
|
+
* // use window.readfile to read contents of a file
|
4314
|
+
* const content = await window.readfile('/etc/hosts');
|
4315
|
+
* console.log(content);
|
4316
|
+
* });
|
4317
|
+
* await browser.close();
|
4230
4318
|
* })();
|
4231
4319
|
* ```
|
4320
|
+
*
|
4321
|
+
* @param name - Name of the function on the window object
|
4322
|
+
* @param pptrFunction - Callback function which will be called in Puppeteer's
|
4323
|
+
* context.
|
4232
4324
|
*/
|
4233
4325
|
exposeFunction(name: string, pptrFunction: Function | {
|
4234
4326
|
default: Function;
|
4235
4327
|
}): Promise<void>;
|
4236
4328
|
/**
|
4237
4329
|
* Provide credentials for `HTTP authentication`.
|
4238
|
-
*
|
4330
|
+
*
|
4331
|
+
* @remarks
|
4332
|
+
* To disable authentication, pass `null`.
|
4239
4333
|
*/
|
4240
4334
|
authenticate(credentials: Credentials): Promise<void>;
|
4241
4335
|
/**
|
4242
4336
|
* The extra HTTP headers will be sent with every request the page initiates.
|
4243
|
-
*
|
4337
|
+
*
|
4338
|
+
* :::tip
|
4339
|
+
*
|
4340
|
+
* All HTTP header names are lowercased. (HTTP headers are
|
4244
4341
|
* case-insensitive, so this shouldn’t impact your server code.)
|
4245
|
-
*
|
4342
|
+
*
|
4343
|
+
* :::
|
4344
|
+
*
|
4345
|
+
* :::note
|
4346
|
+
*
|
4347
|
+
* page.setExtraHTTPHeaders does not guarantee the order of headers in
|
4246
4348
|
* the outgoing requests.
|
4349
|
+
*
|
4350
|
+
* :::
|
4351
|
+
*
|
4247
4352
|
* @param headers - An object containing additional HTTP headers to be sent
|
4248
4353
|
* with every request. All header values must be strings.
|
4249
|
-
* @returns
|
4250
4354
|
*/
|
4251
4355
|
setExtraHTTPHeaders(headers: Record<string, string>): Promise<void>;
|
4252
4356
|
/**
|
@@ -4282,12 +4386,12 @@ export declare class HTTPResponse {
|
|
4282
4386
|
*
|
4283
4387
|
* - `TaskDuration` : Combined duration of all tasks performed by the browser.
|
4284
4388
|
*
|
4285
|
-
*
|
4286
4389
|
* - `JSHeapUsedSize` : Used JavaScript heap size.
|
4287
4390
|
*
|
4288
4391
|
* - `JSHeapTotalSize` : Total JavaScript heap size.
|
4392
|
+
*
|
4289
4393
|
* @remarks
|
4290
|
-
*
|
4394
|
+
* All timestamps are in monotonic time: monotonically increasing time
|
4291
4395
|
* in seconds since an arbitrary point in the past.
|
4292
4396
|
*/
|
4293
4397
|
metrics(): Promise<Metrics>;
|
@@ -4311,17 +4415,17 @@ export declare class HTTPResponse {
|
|
4311
4415
|
* {@link Page.setDefaultTimeout} methods.
|
4312
4416
|
*
|
4313
4417
|
* - `waitUntil`: When to consider setting markup succeeded, defaults to
|
4314
|
-
*
|
4315
|
-
*
|
4316
|
-
*
|
4317
|
-
*
|
4318
|
-
*
|
4319
|
-
*
|
4320
|
-
*
|
4321
|
-
*
|
4322
|
-
*
|
4323
|
-
*
|
4324
|
-
*
|
4418
|
+
* `load`. Given an array of event strings, setting content is considered
|
4419
|
+
* to be successful after all events have been fired. Events can be
|
4420
|
+
* either:<br/>
|
4421
|
+
* - `load` : consider setting content to be finished when the `load` event
|
4422
|
+
* is fired.<br/>
|
4423
|
+
* - `domcontentloaded` : consider setting content to be finished when the
|
4424
|
+
* `DOMContentLoaded` event is fired.<br/>
|
4425
|
+
* - `networkidle0` : consider setting content to be finished when there are
|
4426
|
+
* no more than 0 network connections for at least `500` ms.<br/>
|
4427
|
+
* - `networkidle2` : consider setting content to be finished when there are
|
4428
|
+
* no more than 2 network connections for at least `500` ms.
|
4325
4429
|
*/
|
4326
4430
|
setContent(html: string, options?: WaitForOptions): Promise<void>;
|
4327
4431
|
/**
|
@@ -4340,22 +4444,23 @@ export declare class HTTPResponse {
|
|
4340
4444
|
* {@link Page.setDefaultTimeout} methods.
|
4341
4445
|
*
|
4342
4446
|
* - `waitUntil`:When to consider navigation succeeded, defaults to `load`.
|
4343
|
-
*
|
4344
|
-
*
|
4345
|
-
*
|
4346
|
-
*
|
4347
|
-
*
|
4348
|
-
*
|
4349
|
-
*
|
4350
|
-
*
|
4351
|
-
*
|
4352
|
-
*
|
4447
|
+
* Given an array of event strings, navigation is considered to be
|
4448
|
+
* successful after all events have been fired. Events can be either:<br/>
|
4449
|
+
* - `load` : consider navigation to be finished when the load event is
|
4450
|
+
* fired.<br/>
|
4451
|
+
* - `domcontentloaded` : consider navigation to be finished when the
|
4452
|
+
* DOMContentLoaded event is fired.<br/>
|
4453
|
+
* - `networkidle0` : consider navigation to be finished when there are no
|
4454
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
4455
|
+
* - `networkidle2` : consider navigation to be finished when there are no
|
4456
|
+
* more than 2 network connections for at least `500` ms.
|
4353
4457
|
*
|
4354
4458
|
* - `referer` : Referer header value. If provided it will take preference
|
4355
4459
|
* over the referer header value set by
|
4356
4460
|
* {@link Page.setExtraHTTPHeaders |page.setExtraHTTPHeaders()}.
|
4357
4461
|
*
|
4358
4462
|
* `page.goto` will throw an error if:
|
4463
|
+
*
|
4359
4464
|
* - there's an SSL error (e.g. in case of self-signed certificates).
|
4360
4465
|
* - target URL is invalid.
|
4361
4466
|
* - the timeout is exceeded during navigation.
|
@@ -4363,9 +4468,9 @@ export declare class HTTPResponse {
|
|
4363
4468
|
* - the main resource failed to load.
|
4364
4469
|
*
|
4365
4470
|
* `page.goto` will not throw an error when any valid HTTP status code is
|
4366
|
-
*
|
4367
|
-
*
|
4368
|
-
*
|
4471
|
+
* returned by the remote server, including 404 "Not Found" and 500
|
4472
|
+
* "Internal Server Error". The status code for such responses can be
|
4473
|
+
* retrieved by calling response.status().
|
4369
4474
|
*
|
4370
4475
|
* NOTE: `page.goto` either throws an error or returns a main resource
|
4371
4476
|
* response. The only exceptions are navigation to about:blank or navigation
|
@@ -4395,16 +4500,16 @@ export declare class HTTPResponse {
|
|
4395
4500
|
* {@link Page.setDefaultTimeout} methods.
|
4396
4501
|
*
|
4397
4502
|
* - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
|
4398
|
-
*
|
4399
|
-
*
|
4400
|
-
*
|
4401
|
-
*
|
4402
|
-
*
|
4403
|
-
*
|
4404
|
-
*
|
4405
|
-
*
|
4406
|
-
*
|
4407
|
-
*
|
4503
|
+
* Given an array of event strings, navigation is considered to be
|
4504
|
+
* successful after all events have been fired. Events can be either:<br/>
|
4505
|
+
* - `load` : consider navigation to be finished when the load event is
|
4506
|
+
* fired.<br/>
|
4507
|
+
* - `domcontentloaded` : consider navigation to be finished when the
|
4508
|
+
* DOMContentLoaded event is fired.<br/>
|
4509
|
+
* - `networkidle0` : consider navigation to be finished when there are no
|
4510
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
4511
|
+
* - `networkidle2` : consider navigation to be finished when there are no
|
4512
|
+
* more than 2 network connections for at least `500` ms.
|
4408
4513
|
*/
|
4409
4514
|
reload(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
4410
4515
|
/**
|
@@ -4412,10 +4517,11 @@ export declare class HTTPResponse {
|
|
4412
4517
|
* you run code that will indirectly cause the page to navigate.
|
4413
4518
|
*
|
4414
4519
|
* @example
|
4520
|
+
*
|
4415
4521
|
* ```ts
|
4416
4522
|
* const [response] = await Promise.all([
|
4417
|
-
*
|
4418
|
-
*
|
4523
|
+
* page.waitForNavigation(), // The promise resolves after navigation has finished
|
4524
|
+
* page.click('a.my-link'), // Clicking the link will indirectly cause a navigation
|
4419
4525
|
* ]);
|
4420
4526
|
* ```
|
4421
4527
|
*
|
@@ -4427,6 +4533,7 @@ export declare class HTTPResponse {
|
|
4427
4533
|
* @param options - Navigation parameters which might have the following
|
4428
4534
|
* properties:
|
4429
4535
|
* @returns A `Promise` which resolves to the main resource response.
|
4536
|
+
*
|
4430
4537
|
* - In case of multiple redirects, the navigation will resolve with the
|
4431
4538
|
* response of the last redirect.
|
4432
4539
|
* - In case of navigation to a different anchor or navigation due to History
|
@@ -4438,25 +4545,27 @@ export declare class HTTPResponse {
|
|
4438
4545
|
* @param options - Optional waiting parameters
|
4439
4546
|
* @returns Promise which resolves to the matched response
|
4440
4547
|
* @example
|
4548
|
+
*
|
4441
4549
|
* ```ts
|
4442
4550
|
* const firstResponse = await page.waitForResponse(
|
4443
|
-
*
|
4551
|
+
* 'https://example.com/resource'
|
4444
4552
|
* );
|
4445
4553
|
* const finalResponse = await page.waitForResponse(
|
4446
|
-
*
|
4447
|
-
*
|
4554
|
+
* response =>
|
4555
|
+
* response.url() === 'https://example.com' && response.status() === 200
|
4448
4556
|
* );
|
4449
|
-
* const finalResponse = await page.waitForResponse(async
|
4450
|
-
*
|
4557
|
+
* const finalResponse = await page.waitForResponse(async response => {
|
4558
|
+
* return (await response.text()).includes('<html>');
|
4451
4559
|
* });
|
4452
4560
|
* return finalResponse.ok();
|
4453
4561
|
* ```
|
4562
|
+
*
|
4454
4563
|
* @remarks
|
4455
4564
|
* Optional Waiting Parameters have:
|
4456
4565
|
*
|
4457
4566
|
* - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds, pass
|
4458
|
-
*
|
4459
|
-
*
|
4567
|
+
* `0` to disable the timeout. The default value can be changed by using the
|
4568
|
+
* {@link Page.setDefaultTimeout} method.
|
4460
4569
|
*/
|
4461
4570
|
waitForRequest(urlOrPredicate: string | ((req: HTTPRequest) => boolean | Promise<boolean>), options?: {
|
4462
4571
|
timeout?: number;
|
@@ -4466,25 +4575,27 @@ export declare class HTTPResponse {
|
|
4466
4575
|
* @param options - Optional waiting parameters
|
4467
4576
|
* @returns Promise which resolves to the matched response.
|
4468
4577
|
* @example
|
4578
|
+
*
|
4469
4579
|
* ```ts
|
4470
4580
|
* const firstResponse = await page.waitForResponse(
|
4471
|
-
*
|
4581
|
+
* 'https://example.com/resource'
|
4472
4582
|
* );
|
4473
4583
|
* const finalResponse = await page.waitForResponse(
|
4474
|
-
*
|
4475
|
-
*
|
4584
|
+
* response =>
|
4585
|
+
* response.url() === 'https://example.com' && response.status() === 200
|
4476
4586
|
* );
|
4477
|
-
* const finalResponse = await page.waitForResponse(async
|
4478
|
-
*
|
4587
|
+
* const finalResponse = await page.waitForResponse(async response => {
|
4588
|
+
* return (await response.text()).includes('<html>');
|
4479
4589
|
* });
|
4480
4590
|
* return finalResponse.ok();
|
4481
4591
|
* ```
|
4592
|
+
*
|
4482
4593
|
* @remarks
|
4483
4594
|
* Optional Parameter have:
|
4484
4595
|
*
|
4485
4596
|
* - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
|
4486
|
-
*
|
4487
|
-
*
|
4597
|
+
* pass `0` to disable the timeout. The default value can be changed by using
|
4598
|
+
* the {@link Page.setDefaultTimeout} method.
|
4488
4599
|
*/
|
4489
4600
|
waitForResponse(urlOrPredicate: string | ((res: HTTPResponse) => boolean | Promise<boolean>), options?: {
|
4490
4601
|
timeout?: number;
|
@@ -4502,17 +4613,19 @@ export declare class HTTPResponse {
|
|
4502
4613
|
* @param options - Optional waiting parameters
|
4503
4614
|
* @returns Promise which resolves to the matched frame.
|
4504
4615
|
* @example
|
4616
|
+
*
|
4505
4617
|
* ```ts
|
4506
|
-
* const frame = await page.waitForFrame(async
|
4618
|
+
* const frame = await page.waitForFrame(async frame => {
|
4507
4619
|
* return frame.name() === 'Test';
|
4508
4620
|
* });
|
4509
4621
|
* ```
|
4622
|
+
*
|
4510
4623
|
* @remarks
|
4511
4624
|
* Optional Parameter have:
|
4512
4625
|
*
|
4513
4626
|
* - `timeout`: Maximum wait time in milliseconds, defaults to `30` seconds,
|
4514
|
-
*
|
4515
|
-
*
|
4627
|
+
* pass `0` to disable the timeout. The default value can be changed by using
|
4628
|
+
* the {@link Page.setDefaultTimeout} method.
|
4516
4629
|
*/
|
4517
4630
|
waitForFrame(urlOrPredicate: string | ((frame: Frame) => boolean | Promise<boolean>), options?: {
|
4518
4631
|
timeout?: number;
|
@@ -4532,16 +4645,16 @@ export declare class HTTPResponse {
|
|
4532
4645
|
* {@link Page.setDefaultTimeout} methods.
|
4533
4646
|
*
|
4534
4647
|
* - `waitUntil` : When to consider navigation succeeded, defaults to `load`.
|
4535
|
-
*
|
4536
|
-
*
|
4537
|
-
*
|
4538
|
-
*
|
4539
|
-
*
|
4540
|
-
*
|
4541
|
-
*
|
4542
|
-
*
|
4543
|
-
*
|
4544
|
-
*
|
4648
|
+
* Given an array of event strings, navigation is considered to be
|
4649
|
+
* successful after all events have been fired. Events can be either:<br/>
|
4650
|
+
* - `load` : consider navigation to be finished when the load event is
|
4651
|
+
* fired.<br/>
|
4652
|
+
* - `domcontentloaded` : consider navigation to be finished when the
|
4653
|
+
* DOMContentLoaded event is fired.<br/>
|
4654
|
+
* - `networkidle0` : consider navigation to be finished when there are no
|
4655
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
4656
|
+
* - `networkidle2` : consider navigation to be finished when there are no
|
4657
|
+
* more than 2 network connections for at least `500` ms.
|
4545
4658
|
*/
|
4546
4659
|
goBack(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
4547
4660
|
/**
|
@@ -4559,16 +4672,16 @@ export declare class HTTPResponse {
|
|
4559
4672
|
* {@link Page.setDefaultTimeout} methods.
|
4560
4673
|
*
|
4561
4674
|
* - `waitUntil`: When to consider navigation succeeded, defaults to `load`.
|
4562
|
-
*
|
4563
|
-
*
|
4564
|
-
*
|
4565
|
-
*
|
4566
|
-
*
|
4567
|
-
*
|
4568
|
-
*
|
4569
|
-
*
|
4570
|
-
*
|
4571
|
-
*
|
4675
|
+
* Given an array of event strings, navigation is considered to be
|
4676
|
+
* successful after all events have been fired. Events can be either:<br/>
|
4677
|
+
* - `load` : consider navigation to be finished when the load event is
|
4678
|
+
* fired.<br/>
|
4679
|
+
* - `domcontentloaded` : consider navigation to be finished when the
|
4680
|
+
* DOMContentLoaded event is fired.<br/>
|
4681
|
+
* - `networkidle0` : consider navigation to be finished when there are no
|
4682
|
+
* more than 0 network connections for at least `500` ms.<br/>
|
4683
|
+
* - `networkidle2` : consider navigation to be finished when there are no
|
4684
|
+
* more than 2 network connections for at least `500` ms.
|
4572
4685
|
*/
|
4573
4686
|
goForward(options?: WaitForOptions): Promise<HTTPResponse | null>;
|
4574
4687
|
/**
|
@@ -4586,18 +4699,20 @@ export declare class HTTPResponse {
|
|
4586
4699
|
* don't expect phones to change size, so you should emulate before navigating
|
4587
4700
|
* to the page.
|
4588
4701
|
* @example
|
4702
|
+
*
|
4589
4703
|
* ```ts
|
4590
4704
|
* const puppeteer = require('puppeteer');
|
4591
4705
|
* const iPhone = puppeteer.devices['iPhone 6'];
|
4592
4706
|
* (async () => {
|
4593
|
-
*
|
4594
|
-
*
|
4595
|
-
*
|
4596
|
-
*
|
4597
|
-
*
|
4598
|
-
*
|
4707
|
+
* const browser = await puppeteer.launch();
|
4708
|
+
* const page = await browser.newPage();
|
4709
|
+
* await page.emulate(iPhone);
|
4710
|
+
* await page.goto('https://www.google.com');
|
4711
|
+
* // other actions...
|
4712
|
+
* await browser.close();
|
4599
4713
|
* })();
|
4600
4714
|
* ```
|
4715
|
+
*
|
4601
4716
|
* @remarks List of all available devices is available in the source code:
|
4602
4717
|
* {@link https://github.com/puppeteer/puppeteer/blob/main/src/common/DeviceDescriptors.ts | src/common/DeviceDescriptors.ts}.
|
4603
4718
|
*/
|
@@ -4627,6 +4742,7 @@ export declare class HTTPResponse {
|
|
4627
4742
|
* values are `screen`, `print` and `null`. Passing `null` disables CSS media
|
4628
4743
|
* emulation.
|
4629
4744
|
* @example
|
4745
|
+
*
|
4630
4746
|
* ```ts
|
4631
4747
|
* await page.evaluate(() => matchMedia('screen').matches);
|
4632
4748
|
* // → true
|
@@ -4657,45 +4773,54 @@ export declare class HTTPResponse {
|
|
4657
4773
|
* objects, emulates CSS media features on the page. Each media feature object
|
4658
4774
|
* must have the following properties:
|
4659
4775
|
* @example
|
4776
|
+
*
|
4660
4777
|
* ```ts
|
4661
4778
|
* await page.emulateMediaFeatures([
|
4662
|
-
*
|
4779
|
+
* {name: 'prefers-color-scheme', value: 'dark'},
|
4663
4780
|
* ]);
|
4664
|
-
* await page.evaluate(
|
4781
|
+
* await page.evaluate(
|
4782
|
+
* () => matchMedia('(prefers-color-scheme: dark)').matches
|
4783
|
+
* );
|
4665
4784
|
* // → true
|
4666
|
-
* await page.evaluate(
|
4785
|
+
* await page.evaluate(
|
4786
|
+
* () => matchMedia('(prefers-color-scheme: light)').matches
|
4787
|
+
* );
|
4667
4788
|
* // → false
|
4668
4789
|
*
|
4669
4790
|
* await page.emulateMediaFeatures([
|
4670
|
-
*
|
4791
|
+
* {name: 'prefers-reduced-motion', value: 'reduce'},
|
4671
4792
|
* ]);
|
4672
4793
|
* await page.evaluate(
|
4673
|
-
*
|
4794
|
+
* () => matchMedia('(prefers-reduced-motion: reduce)').matches
|
4674
4795
|
* );
|
4675
4796
|
* // → true
|
4676
4797
|
* await page.evaluate(
|
4677
|
-
*
|
4798
|
+
* () => matchMedia('(prefers-reduced-motion: no-preference)').matches
|
4678
4799
|
* );
|
4679
4800
|
* // → false
|
4680
4801
|
*
|
4681
4802
|
* await page.emulateMediaFeatures([
|
4682
|
-
*
|
4683
|
-
*
|
4803
|
+
* {name: 'prefers-color-scheme', value: 'dark'},
|
4804
|
+
* {name: 'prefers-reduced-motion', value: 'reduce'},
|
4684
4805
|
* ]);
|
4685
|
-
* await page.evaluate(
|
4806
|
+
* await page.evaluate(
|
4807
|
+
* () => matchMedia('(prefers-color-scheme: dark)').matches
|
4808
|
+
* );
|
4686
4809
|
* // → true
|
4687
|
-
* await page.evaluate(
|
4810
|
+
* await page.evaluate(
|
4811
|
+
* () => matchMedia('(prefers-color-scheme: light)').matches
|
4812
|
+
* );
|
4688
4813
|
* // → false
|
4689
4814
|
* await page.evaluate(
|
4690
|
-
*
|
4815
|
+
* () => matchMedia('(prefers-reduced-motion: reduce)').matches
|
4691
4816
|
* );
|
4692
4817
|
* // → true
|
4693
4818
|
* await page.evaluate(
|
4694
|
-
*
|
4819
|
+
* () => matchMedia('(prefers-reduced-motion: no-preference)').matches
|
4695
4820
|
* );
|
4696
4821
|
* // → false
|
4697
4822
|
*
|
4698
|
-
* await page.emulateMediaFeatures([{
|
4823
|
+
* await page.emulateMediaFeatures([{name: 'color-gamut', value: 'p3'}]);
|
4699
4824
|
* await page.evaluate(() => matchMedia('(color-gamut: srgb)').matches);
|
4700
4825
|
* // → true
|
4701
4826
|
* await page.evaluate(() => matchMedia('(color-gamut: p3)').matches);
|
@@ -4717,6 +4842,7 @@ export declare class HTTPResponse {
|
|
4717
4842
|
* If no arguments set, clears idle state emulation.
|
4718
4843
|
*
|
4719
4844
|
* @example
|
4845
|
+
*
|
4720
4846
|
* ```ts
|
4721
4847
|
* // set idle emulation
|
4722
4848
|
* await page.emulateIdleState({isUserActive: true, isScreenUnlocked: false});
|
@@ -4738,6 +4864,7 @@ export declare class HTTPResponse {
|
|
4738
4864
|
* Simulates the given vision deficiency on the page.
|
4739
4865
|
*
|
4740
4866
|
* @example
|
4867
|
+
*
|
4741
4868
|
* ```ts
|
4742
4869
|
* const puppeteer = require('puppeteer');
|
4743
4870
|
*
|
@@ -4747,13 +4874,13 @@ export declare class HTTPResponse {
|
|
4747
4874
|
* await page.goto('https://v8.dev/blog/10-years');
|
4748
4875
|
*
|
4749
4876
|
* await page.emulateVisionDeficiency('achromatopsia');
|
4750
|
-
* await page.screenshot({
|
4877
|
+
* await page.screenshot({path: 'achromatopsia.png'});
|
4751
4878
|
*
|
4752
4879
|
* await page.emulateVisionDeficiency('deuteranopia');
|
4753
|
-
* await page.screenshot({
|
4880
|
+
* await page.screenshot({path: 'deuteranopia.png'});
|
4754
4881
|
*
|
4755
4882
|
* await page.emulateVisionDeficiency('blurredVision');
|
4756
|
-
* await page.screenshot({
|
4883
|
+
* await page.screenshot({path: 'blurred-vision.png'});
|
4757
4884
|
*
|
4758
4885
|
* await browser.close();
|
4759
4886
|
* })();
|
@@ -4770,12 +4897,13 @@ export declare class HTTPResponse {
|
|
4770
4897
|
* In the case of multiple pages in a single browser, each page can have its
|
4771
4898
|
* own viewport size.
|
4772
4899
|
* @example
|
4900
|
+
*
|
4773
4901
|
* ```ts
|
4774
4902
|
* const page = await browser.newPage();
|
4775
4903
|
* await page.setViewport({
|
4776
|
-
*
|
4777
|
-
*
|
4778
|
-
*
|
4904
|
+
* width: 640,
|
4905
|
+
* height: 480,
|
4906
|
+
* deviceScaleFactor: 1,
|
4779
4907
|
* });
|
4780
4908
|
* await page.goto('https://example.com');
|
4781
4909
|
* ```
|
@@ -4823,8 +4951,6 @@ export declare class HTTPResponse {
|
|
4823
4951
|
*/
|
4824
4952
|
viewport(): Viewport | null;
|
4825
4953
|
/**
|
4826
|
-
* @remarks
|
4827
|
-
*
|
4828
4954
|
* Evaluates a function in the page's context and returns the result.
|
4829
4955
|
*
|
4830
4956
|
* If the function passed to `page.evaluteHandle` returns a Promise, the
|
@@ -4843,6 +4969,7 @@ export declare class HTTPResponse {
|
|
4843
4969
|
* recommended as they are easier to debug and use with TypeScript):
|
4844
4970
|
*
|
4845
4971
|
* @example
|
4972
|
+
*
|
4846
4973
|
* ```ts
|
4847
4974
|
* const aHandle = await page.evaluate('1 + 2');
|
4848
4975
|
* ```
|
@@ -4877,7 +5004,7 @@ export declare class HTTPResponse {
|
|
4877
5004
|
* - whenever the page is navigated
|
4878
5005
|
*
|
4879
5006
|
* - whenever the child frame is attached or navigated. In this case, the
|
4880
|
-
*
|
5007
|
+
* function is invoked in the context of the newly attached frame.
|
4881
5008
|
*
|
4882
5009
|
* The function is invoked after the document was created but before any of
|
4883
5010
|
* its scripts were run. This is useful to amend the JavaScript environment,
|
@@ -4886,6 +5013,7 @@ export declare class HTTPResponse {
|
|
4886
5013
|
* @param args - Arguments to pass to `pageFunction`
|
4887
5014
|
* @example
|
4888
5015
|
* An example of overriding the navigator.languages property before the page loads:
|
5016
|
+
*
|
4889
5017
|
* ```ts
|
4890
5018
|
* // preload.js
|
4891
5019
|
*
|
@@ -4931,10 +5059,10 @@ export declare class HTTPResponse {
|
|
4931
5059
|
*
|
4932
5060
|
* - `clip` : An object which specifies clipping region of the page.
|
4933
5061
|
* Should have the following fields:<br/>
|
4934
|
-
*
|
4935
|
-
*
|
4936
|
-
*
|
4937
|
-
*
|
5062
|
+
* - `x` : x-coordinate of top-left corner of clip area.<br/>
|
5063
|
+
* - `y` : y-coordinate of top-left corner of clip area.<br/>
|
5064
|
+
* - `width` : width of clipping area.<br/>
|
5065
|
+
* - `height` : height of clipping area.
|
4938
5066
|
*
|
4939
5067
|
* - `omitBackground` : Hides default white background and allows
|
4940
5068
|
* capturing screenshots with transparency. Defaults to `false`.
|
@@ -4974,7 +5102,6 @@ export declare class HTTPResponse {
|
|
4974
5102
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/-webkit-print-color-adjust | `-webkit-print-color-adjust`}
|
4975
5103
|
* property to force rendering of exact colors.
|
4976
5104
|
*
|
4977
|
-
*
|
4978
5105
|
* @param options - options for generating the PDF.
|
4979
5106
|
*/
|
4980
5107
|
createPDFStream(options?: PDFOptions): Promise<Readable>;
|
@@ -5007,12 +5134,14 @@ export declare class HTTPResponse {
|
|
5007
5134
|
* there's a separate `page.waitForNavigation()` promise to be resolved, you
|
5008
5135
|
* may end up with a race condition that yields unexpected results. The
|
5009
5136
|
* correct pattern for click and wait for navigation is the following:
|
5137
|
+
*
|
5010
5138
|
* ```ts
|
5011
5139
|
* const [response] = await Promise.all([
|
5012
|
-
*
|
5013
|
-
*
|
5140
|
+
* page.waitForNavigation(waitOptions),
|
5141
|
+
* page.click(selector, clickOptions),
|
5014
5142
|
* ]);
|
5015
5143
|
* ```
|
5144
|
+
*
|
5016
5145
|
* Shortcut for {@link Frame.click | page.mainFrame().click(selector[, options]) }.
|
5017
5146
|
* @param selector - A `selector` to search for element to click. If there are
|
5018
5147
|
* multiple elements satisfying the `selector`, the first will be clicked
|
@@ -5033,7 +5162,7 @@ export declare class HTTPResponse {
|
|
5033
5162
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector }
|
5034
5163
|
* of an element to focus. If there are multiple elements satisfying the
|
5035
5164
|
* selector, the first will be focused.
|
5036
|
-
* @returns
|
5165
|
+
* @returns Promise which resolves when the element matching selector is
|
5037
5166
|
* successfully focused. The promise will be rejected if there is no element
|
5038
5167
|
* matching selector.
|
5039
5168
|
* @remarks
|
@@ -5061,10 +5190,12 @@ export declare class HTTPResponse {
|
|
5061
5190
|
* throws an error.
|
5062
5191
|
*
|
5063
5192
|
* @example
|
5193
|
+
*
|
5064
5194
|
* ```ts
|
5065
5195
|
* page.select('select#colors', 'blue'); // single selection
|
5066
5196
|
* page.select('select#colors', 'red', 'green', 'blue'); // multiple selections
|
5067
5197
|
* ```
|
5198
|
+
*
|
5068
5199
|
* @param selector - A
|
5069
5200
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | Selector}
|
5070
5201
|
* to query the page for
|
@@ -5096,12 +5227,14 @@ export declare class HTTPResponse {
|
|
5096
5227
|
*
|
5097
5228
|
* To press a special key, like `Control` or `ArrowDown`, use {@link Keyboard.press}.
|
5098
5229
|
* @example
|
5230
|
+
*
|
5099
5231
|
* ```ts
|
5100
5232
|
* await page.type('#mytextarea', 'Hello');
|
5101
5233
|
* // Types instantly
|
5102
|
-
* await page.type('#mytextarea', 'World', {
|
5234
|
+
* await page.type('#mytextarea', 'World', {delay: 100});
|
5103
5235
|
* // Types slower, like a user
|
5104
5236
|
* ```
|
5237
|
+
*
|
5105
5238
|
* @param selector - A
|
5106
5239
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
5107
5240
|
* of an element to type into. If there are multiple elements satisfying the
|
@@ -5116,13 +5249,14 @@ export declare class HTTPResponse {
|
|
5116
5249
|
delay: number;
|
5117
5250
|
}): Promise<void>;
|
5118
5251
|
/**
|
5252
|
+
* @deprecated Use `new Promise(r => setTimeout(r, milliseconds));`.
|
5253
|
+
*
|
5119
5254
|
* Causes your script to wait for the given number of milliseconds.
|
5120
5255
|
*
|
5121
5256
|
* @remarks
|
5122
|
-
*
|
5123
5257
|
* It's generally recommended to not wait for a number of seconds, but instead
|
5124
|
-
* use {@link
|
5125
|
-
* {@link
|
5258
|
+
* use {@link Frame.waitForSelector}, {@link Frame.waitForXPath} or
|
5259
|
+
* {@link Frame.waitForFunction} to wait for exactly the conditions you want.
|
5126
5260
|
*
|
5127
5261
|
* @example
|
5128
5262
|
*
|
@@ -5142,25 +5276,27 @@ export declare class HTTPResponse {
|
|
5142
5276
|
* function will throw.
|
5143
5277
|
*
|
5144
5278
|
* This method works across navigations:
|
5279
|
+
*
|
5145
5280
|
* ```ts
|
5146
5281
|
* const puppeteer = require('puppeteer');
|
5147
5282
|
* (async () => {
|
5148
|
-
*
|
5149
|
-
*
|
5150
|
-
*
|
5151
|
-
*
|
5152
|
-
*
|
5153
|
-
*
|
5154
|
-
*
|
5155
|
-
*
|
5156
|
-
*
|
5157
|
-
*
|
5158
|
-
*
|
5159
|
-
*
|
5160
|
-
*
|
5161
|
-
*
|
5283
|
+
* const browser = await puppeteer.launch();
|
5284
|
+
* const page = await browser.newPage();
|
5285
|
+
* let currentURL;
|
5286
|
+
* page
|
5287
|
+
* .waitForSelector('img')
|
5288
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
5289
|
+
* for (currentURL of [
|
5290
|
+
* 'https://example.com',
|
5291
|
+
* 'https://google.com',
|
5292
|
+
* 'https://bbc.com',
|
5293
|
+
* ]) {
|
5294
|
+
* await page.goto(currentURL);
|
5295
|
+
* }
|
5296
|
+
* await browser.close();
|
5162
5297
|
* })();
|
5163
5298
|
* ```
|
5299
|
+
*
|
5164
5300
|
* @param selector - A
|
5165
5301
|
* {@link https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Selectors | selector}
|
5166
5302
|
* of an element to wait for
|
@@ -5172,16 +5308,16 @@ export declare class HTTPResponse {
|
|
5172
5308
|
* The optional Parameter in Arguments `options` are :
|
5173
5309
|
*
|
5174
5310
|
* - `Visible`: A boolean wait for element to be present in DOM and to be
|
5175
|
-
*
|
5176
|
-
*
|
5311
|
+
* visible, i.e. to not have `display: none` or `visibility: hidden` CSS
|
5312
|
+
* properties. Defaults to `false`.
|
5177
5313
|
*
|
5178
5314
|
* - `hidden`: Wait for element to not be found in the DOM or to be hidden,
|
5179
|
-
*
|
5180
|
-
*
|
5315
|
+
* i.e. have `display: none` or `visibility: hidden` CSS properties. Defaults to
|
5316
|
+
* `false`.
|
5181
5317
|
*
|
5182
5318
|
* - `timeout`: maximum time to wait for in milliseconds. Defaults to `30000`
|
5183
|
-
*
|
5184
|
-
*
|
5319
|
+
* (30 seconds). Pass `0` to disable timeout. The default value can be changed
|
5320
|
+
* by using the {@link Page.setDefaultTimeout} method.
|
5185
5321
|
*/
|
5186
5322
|
waitForSelector<Selector extends string>(selector: Selector, options?: Exclude<WaitForSelectorOptions, 'root'>): Promise<ElementHandle<NodeFor<Selector>> | null>;
|
5187
5323
|
/**
|
@@ -5191,25 +5327,27 @@ export declare class HTTPResponse {
|
|
5191
5327
|
* function will throw.
|
5192
5328
|
*
|
5193
5329
|
* This method works across navigation
|
5330
|
+
*
|
5194
5331
|
* ```ts
|
5195
5332
|
* const puppeteer = require('puppeteer');
|
5196
5333
|
* (async () => {
|
5197
|
-
*
|
5198
|
-
*
|
5199
|
-
*
|
5200
|
-
*
|
5201
|
-
*
|
5202
|
-
*
|
5203
|
-
*
|
5204
|
-
*
|
5205
|
-
*
|
5206
|
-
*
|
5207
|
-
*
|
5208
|
-
*
|
5209
|
-
*
|
5210
|
-
*
|
5334
|
+
* const browser = await puppeteer.launch();
|
5335
|
+
* const page = await browser.newPage();
|
5336
|
+
* let currentURL;
|
5337
|
+
* page
|
5338
|
+
* .waitForXPath('//img')
|
5339
|
+
* .then(() => console.log('First URL with image: ' + currentURL));
|
5340
|
+
* for (currentURL of [
|
5341
|
+
* 'https://example.com',
|
5342
|
+
* 'https://google.com',
|
5343
|
+
* 'https://bbc.com',
|
5344
|
+
* ]) {
|
5345
|
+
* await page.goto(currentURL);
|
5346
|
+
* }
|
5347
|
+
* await browser.close();
|
5211
5348
|
* })();
|
5212
5349
|
* ```
|
5350
|
+
*
|
5213
5351
|
* @param xpath - A
|
5214
5352
|
* {@link https://developer.mozilla.org/en-US/docs/Web/XPath | xpath} of an
|
5215
5353
|
* element to wait for
|
@@ -5221,16 +5359,16 @@ export declare class HTTPResponse {
|
|
5221
5359
|
* The optional Argument `options` have properties:
|
5222
5360
|
*
|
5223
5361
|
* - `visible`: A boolean to wait for element to be present in DOM and to be
|
5224
|
-
*
|
5225
|
-
*
|
5362
|
+
* visible, i.e. to not have `display: none` or `visibility: hidden` CSS
|
5363
|
+
* properties. Defaults to `false`.
|
5226
5364
|
*
|
5227
5365
|
* - `hidden`: A boolean wait for element to not be found in the DOM or to be
|
5228
|
-
*
|
5229
|
-
*
|
5366
|
+
* hidden, i.e. have `display: none` or `visibility: hidden` CSS properties.
|
5367
|
+
* Defaults to `false`.
|
5230
5368
|
*
|
5231
5369
|
* - `timeout`: A number which is maximum time to wait for in milliseconds.
|
5232
|
-
*
|
5233
|
-
*
|
5370
|
+
* Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The default
|
5371
|
+
* value can be changed by using the {@link Page.setDefaultTimeout} method.
|
5234
5372
|
*/
|
5235
5373
|
waitForXPath(xpath: string, options?: {
|
5236
5374
|
visible?: boolean;
|
@@ -5246,65 +5384,68 @@ export declare class HTTPResponse {
|
|
5246
5384
|
* ```ts
|
5247
5385
|
* const puppeteer = require('puppeteer');
|
5248
5386
|
* (async () => {
|
5249
|
-
*
|
5250
|
-
*
|
5251
|
-
*
|
5252
|
-
*
|
5253
|
-
*
|
5254
|
-
*
|
5387
|
+
* const browser = await puppeteer.launch();
|
5388
|
+
* const page = await browser.newPage();
|
5389
|
+
* const watchDog = page.waitForFunction('window.innerWidth < 100');
|
5390
|
+
* await page.setViewport({width: 50, height: 50});
|
5391
|
+
* await watchDog;
|
5392
|
+
* await browser.close();
|
5255
5393
|
* })();
|
5256
5394
|
* ```
|
5257
5395
|
*
|
5258
5396
|
* @example
|
5259
5397
|
* To pass arguments from node.js to the predicate of
|
5260
5398
|
* {@link Page.waitForFunction} function:
|
5399
|
+
*
|
5261
5400
|
* ```ts
|
5262
5401
|
* const selector = '.foo';
|
5263
5402
|
* await page.waitForFunction(
|
5264
|
-
*
|
5265
|
-
*
|
5266
|
-
*
|
5403
|
+
* selector => !!document.querySelector(selector),
|
5404
|
+
* {},
|
5405
|
+
* selector
|
5267
5406
|
* );
|
5268
5407
|
* ```
|
5269
5408
|
*
|
5270
5409
|
* @example
|
5271
5410
|
* The predicate of {@link Page.waitForFunction} can be asynchronous too:
|
5411
|
+
*
|
5272
5412
|
* ```ts
|
5273
5413
|
* const username = 'github-username';
|
5274
5414
|
* await page.waitForFunction(
|
5275
|
-
*
|
5276
|
-
*
|
5277
|
-
*
|
5278
|
-
*
|
5279
|
-
*
|
5280
|
-
*
|
5281
|
-
*
|
5282
|
-
*
|
5283
|
-
*
|
5284
|
-
*
|
5285
|
-
*
|
5286
|
-
*
|
5287
|
-
*
|
5288
|
-
*
|
5415
|
+
* async username => {
|
5416
|
+
* const githubResponse = await fetch(
|
5417
|
+
* `https://api.github.com/users/${username}`
|
5418
|
+
* );
|
5419
|
+
* const githubUser = await githubResponse.json();
|
5420
|
+
* // show the avatar
|
5421
|
+
* const img = document.createElement('img');
|
5422
|
+
* img.src = githubUser.avatar_url;
|
5423
|
+
* // wait 3 seconds
|
5424
|
+
* await new Promise((resolve, reject) => setTimeout(resolve, 3000));
|
5425
|
+
* img.remove();
|
5426
|
+
* },
|
5427
|
+
* {},
|
5428
|
+
* username
|
5289
5429
|
* );
|
5290
5430
|
* ```
|
5291
5431
|
*
|
5292
5432
|
* @param pageFunction - Function to be evaluated in browser context
|
5293
5433
|
* @param options - Optional waiting parameters
|
5434
|
+
*
|
5294
5435
|
* - `polling` - An interval at which the `pageFunction` is executed, defaults
|
5295
5436
|
* to `raf`. If `polling` is a number, then it is treated as an interval in
|
5296
5437
|
* milliseconds at which the function would be executed. If polling is a
|
5297
5438
|
* string, then it can be one of the following values:
|
5298
|
-
*
|
5299
|
-
*
|
5300
|
-
*
|
5301
|
-
*
|
5439
|
+
* - `raf` - to constantly execute `pageFunction` in
|
5440
|
+
* `requestAnimationFrame` callback. This is the tightest polling mode
|
5441
|
+
* which is suitable to observe styling changes.
|
5442
|
+
* - `mutation`- to execute pageFunction on every DOM mutation.
|
5302
5443
|
* - `timeout` - maximum time to wait for in milliseconds. Defaults to `30000`
|
5303
5444
|
* (30 seconds). Pass `0` to disable timeout. The default value can be
|
5304
5445
|
* changed by using the {@link Page.setDefaultTimeout} method.
|
5305
|
-
*
|
5306
|
-
*
|
5307
|
-
*
|
5446
|
+
* @param args - Arguments to pass to `pageFunction`
|
5447
|
+
* @returns A `Promise` which resolves to a JSHandle/ElementHandle of the the
|
5448
|
+
* `pageFunction`'s return value.
|
5308
5449
|
*/
|
5309
5450
|
waitForFunction<Params extends unknown[], Func extends EvaluateFunc<Params> = EvaluateFunc<Params>>(pageFunction: Func | string, options?: {
|
5310
5451
|
timeout?: number;
|
@@ -5328,7 +5469,8 @@ export declare class HTTPResponse {
|
|
5328
5469
|
* @public
|
5329
5470
|
*/
|
5330
5471
|
export declare const enum PageEmittedEvents {
|
5331
|
-
/**
|
5472
|
+
/**
|
5473
|
+
* Emitted when the page closes.
|
5332
5474
|
* @eventProperty
|
5333
5475
|
*/
|
5334
5476
|
Close = "close",
|
@@ -5343,12 +5485,13 @@ export declare class HTTPResponse {
|
|
5343
5485
|
*
|
5344
5486
|
* @example
|
5345
5487
|
* An example of handling `console` event:
|
5488
|
+
*
|
5346
5489
|
* ```ts
|
5347
5490
|
* page.on('console', msg => {
|
5348
5491
|
* for (let i = 0; i < msg.args().length; ++i)
|
5349
|
-
*
|
5350
|
-
*
|
5351
|
-
*
|
5492
|
+
* console.log(`${i}: ${msg.args()[i]}`);
|
5493
|
+
* });
|
5494
|
+
* page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
|
5352
5495
|
* ```
|
5353
5496
|
*/
|
5354
5497
|
Console = "console",
|
@@ -5389,14 +5532,15 @@ export declare class HTTPResponse {
|
|
5389
5532
|
*
|
5390
5533
|
* @remarks
|
5391
5534
|
* Contains an object with two properties:
|
5535
|
+
*
|
5392
5536
|
* - `title`: the title passed to `console.timeStamp`
|
5393
5537
|
* - `metrics`: objec containing metrics as key/value pairs. The values will
|
5394
5538
|
* be `number`s.
|
5395
5539
|
*/
|
5396
5540
|
Metrics = "metrics",
|
5397
5541
|
/**
|
5398
|
-
* Emitted when an uncaught exception happens within the page.
|
5399
|
-
*
|
5542
|
+
* Emitted when an uncaught exception happens within the page. Contains an
|
5543
|
+
* `Error`.
|
5400
5544
|
*/
|
5401
5545
|
PageError = "pageerror",
|
5402
5546
|
/**
|
@@ -5425,12 +5569,13 @@ export declare class HTTPResponse {
|
|
5425
5569
|
* Emitted when a page issues a request and contains a {@link HTTPRequest}.
|
5426
5570
|
*
|
5427
5571
|
* @remarks
|
5428
|
-
* The object is readonly. See {@link Page.setRequestInterception} for
|
5429
|
-
* and mutating requests.
|
5572
|
+
* The object is readonly. See {@link Page.setRequestInterception} for
|
5573
|
+
* intercepting and mutating requests.
|
5430
5574
|
*/
|
5431
5575
|
Request = "request",
|
5432
5576
|
/**
|
5433
|
-
* Emitted when a request ended up loading from cache. Contains a
|
5577
|
+
* Emitted when a request ended up loading from cache. Contains a
|
5578
|
+
* {@link HTTPRequest}.
|
5434
5579
|
*
|
5435
5580
|
* @remarks
|
5436
5581
|
* For certain requests, might contain undefined.
|
@@ -5449,7 +5594,8 @@ export declare class HTTPResponse {
|
|
5449
5594
|
*/
|
5450
5595
|
RequestFailed = "requestfailed",
|
5451
5596
|
/**
|
5452
|
-
* Emitted when a request finishes successfully. Contains a
|
5597
|
+
* Emitted when a request finishes successfully. Contains a
|
5598
|
+
* {@link HTTPRequest}.
|
5453
5599
|
*/
|
5454
5600
|
RequestFinished = "requestfinished",
|
5455
5601
|
/**
|
@@ -5475,6 +5621,7 @@ export declare class HTTPResponse {
|
|
5475
5621
|
*
|
5476
5622
|
* See {@link PageEmittedEvents} for more detail on the events and when they are
|
5477
5623
|
* emitted.
|
5624
|
+
*
|
5478
5625
|
* @public
|
5479
5626
|
*/
|
5480
5627
|
export declare interface PageEventObject {
|
@@ -5508,6 +5655,7 @@ export declare class HTTPResponse {
|
|
5508
5655
|
* @remarks
|
5509
5656
|
*
|
5510
5657
|
* The sizes of each format are as follows:
|
5658
|
+
*
|
5511
5659
|
* - `Letter`: 8.5in x 11in
|
5512
5660
|
*
|
5513
5661
|
* - `Legal`: 8.5in x 14in
|
@@ -5581,6 +5729,7 @@ export declare class HTTPResponse {
|
|
5581
5729
|
/**
|
5582
5730
|
* HTML template for the print header. Should be valid HTML with the following
|
5583
5731
|
* classes used to inject values into them:
|
5732
|
+
*
|
5584
5733
|
* - `date` formatted print date
|
5585
5734
|
*
|
5586
5735
|
* - `title` document title
|
@@ -5771,56 +5920,63 @@ export declare class HTTPResponse {
|
|
5771
5920
|
/**
|
5772
5921
|
* @deprecated Import directly puppeteer.
|
5773
5922
|
* @example
|
5923
|
+
*
|
5774
5924
|
* ```ts
|
5775
|
-
* import {
|
5925
|
+
* import {devices} from 'puppeteer';
|
5776
5926
|
* ```
|
5777
5927
|
*/
|
5778
5928
|
get devices(): typeof devices;
|
5779
5929
|
/**
|
5780
5930
|
* @deprecated Import directly puppeteer.
|
5781
5931
|
* @example
|
5932
|
+
*
|
5782
5933
|
* ```ts
|
5783
|
-
* import {
|
5934
|
+
* import {errors} from 'puppeteer';
|
5784
5935
|
* ```
|
5785
5936
|
*/
|
5786
5937
|
get errors(): typeof errors;
|
5787
5938
|
/**
|
5788
5939
|
* @deprecated Import directly puppeteer.
|
5789
5940
|
* @example
|
5941
|
+
*
|
5790
5942
|
* ```ts
|
5791
|
-
* import {
|
5943
|
+
* import {networkConditions} from 'puppeteer';
|
5792
5944
|
* ```
|
5793
5945
|
*/
|
5794
5946
|
get networkConditions(): typeof networkConditions;
|
5795
5947
|
/**
|
5796
5948
|
* @deprecated Import directly puppeteer.
|
5797
5949
|
* @example
|
5950
|
+
*
|
5798
5951
|
* ```ts
|
5799
|
-
* import {
|
5952
|
+
* import {registerCustomQueryHandler} from 'puppeteer';
|
5800
5953
|
* ```
|
5801
5954
|
*/
|
5802
5955
|
registerCustomQueryHandler(name: string, queryHandler: CustomQueryHandler): void;
|
5803
5956
|
/**
|
5804
5957
|
* @deprecated Import directly puppeteer.
|
5805
5958
|
* @example
|
5959
|
+
*
|
5806
5960
|
* ```ts
|
5807
|
-
* import {
|
5961
|
+
* import {unregisterCustomQueryHandler} from 'puppeteer';
|
5808
5962
|
* ```
|
5809
5963
|
*/
|
5810
5964
|
unregisterCustomQueryHandler(name: string): void;
|
5811
5965
|
/**
|
5812
5966
|
* @deprecated Import directly puppeteer.
|
5813
5967
|
* @example
|
5968
|
+
*
|
5814
5969
|
* ```ts
|
5815
|
-
* import {
|
5970
|
+
* import {customQueryHandlerNames} from 'puppeteer';
|
5816
5971
|
* ```
|
5817
5972
|
*/
|
5818
5973
|
customQueryHandlerNames(): string[];
|
5819
5974
|
/**
|
5820
5975
|
* @deprecated Import directly puppeteer.
|
5821
5976
|
* @example
|
5977
|
+
*
|
5822
5978
|
* ```ts
|
5823
|
-
* import {
|
5979
|
+
* import {clearCustomQueryHandlers} from 'puppeteer';
|
5824
5980
|
* ```
|
5825
5981
|
*/
|
5826
5982
|
clearCustomQueryHandlers(): void;
|
@@ -5828,6 +5984,8 @@ export declare class HTTPResponse {
|
|
5828
5984
|
|
5829
5985
|
/* Excluded from this release type: PUPPETEER_REVISIONS */
|
5830
5986
|
|
5987
|
+
/* Excluded from this release type: PUPPETEER_WORLD */
|
5988
|
+
|
5831
5989
|
/* Excluded from this release type: puppeteerDirname */
|
5832
5990
|
|
5833
5991
|
/**
|
@@ -5869,6 +6027,7 @@ export declare class HTTPResponse {
|
|
5869
6027
|
*
|
5870
6028
|
* @example
|
5871
6029
|
* The following is a typical example of using Puppeteer to drive automation:
|
6030
|
+
*
|
5872
6031
|
* ```ts
|
5873
6032
|
* const puppeteer = require('puppeteer');
|
5874
6033
|
*
|
@@ -5906,9 +6065,10 @@ export declare class HTTPResponse {
|
|
5906
6065
|
*
|
5907
6066
|
* @example
|
5908
6067
|
* You can use `ignoreDefaultArgs` to filter out `--mute-audio` from default arguments:
|
6068
|
+
*
|
5909
6069
|
* ```ts
|
5910
6070
|
* const browser = await puppeteer.launch({
|
5911
|
-
* ignoreDefaultArgs: ['--mute-audio']
|
6071
|
+
* ignoreDefaultArgs: ['--mute-audio'],
|
5912
6072
|
* });
|
5913
6073
|
* ```
|
5914
6074
|
*
|
@@ -5986,6 +6146,7 @@ export declare class HTTPResponse {
|
|
5986
6146
|
* allowed to consist of lower- and upper case latin letters.
|
5987
6147
|
*
|
5988
6148
|
* @example
|
6149
|
+
*
|
5989
6150
|
* ```
|
5990
6151
|
* puppeteer.registerCustomQueryHandler('text', { … });
|
5991
6152
|
* const aHandle = await page.$('text/…');
|
@@ -6053,7 +6214,7 @@ export declare class HTTPResponse {
|
|
6053
6214
|
*/
|
6054
6215
|
export declare interface ScreenshotOptions {
|
6055
6216
|
/**
|
6056
|
-
* @defaultValue
|
6217
|
+
* @defaultValue `png`
|
6057
6218
|
*/
|
6058
6219
|
type?: 'png' | 'jpeg' | 'webp';
|
6059
6220
|
/**
|
@@ -6064,8 +6225,8 @@ export declare class HTTPResponse {
|
|
6064
6225
|
*/
|
6065
6226
|
path?: string;
|
6066
6227
|
/**
|
6067
|
-
* When true
|
6068
|
-
* @defaultValue false
|
6228
|
+
* When `true`, takes a screenshot of the full page.
|
6229
|
+
* @defaultValue `false`
|
6069
6230
|
*/
|
6070
6231
|
fullPage?: boolean;
|
6071
6232
|
/**
|
@@ -6078,22 +6239,22 @@ export declare class HTTPResponse {
|
|
6078
6239
|
quality?: number;
|
6079
6240
|
/**
|
6080
6241
|
* Hides default white background and allows capturing screenshots with transparency.
|
6081
|
-
* @defaultValue false
|
6242
|
+
* @defaultValue `false`
|
6082
6243
|
*/
|
6083
6244
|
omitBackground?: boolean;
|
6084
6245
|
/**
|
6085
6246
|
* Encoding of the image.
|
6086
|
-
* @defaultValue
|
6247
|
+
* @defaultValue `binary`
|
6087
6248
|
*/
|
6088
6249
|
encoding?: 'base64' | 'binary';
|
6089
6250
|
/**
|
6090
6251
|
* Capture the screenshot beyond the viewport.
|
6091
|
-
* @defaultValue true
|
6252
|
+
* @defaultValue `true`
|
6092
6253
|
*/
|
6093
6254
|
captureBeyondViewport?: boolean;
|
6094
6255
|
/**
|
6095
6256
|
* Capture the screenshot from the surface, rather than the view.
|
6096
|
-
* @defaultValue true
|
6257
|
+
* @defaultValue `true`
|
6097
6258
|
*/
|
6098
6259
|
fromSurface?: boolean;
|
6099
6260
|
}
|
@@ -6224,6 +6385,8 @@ export declare class HTTPResponse {
|
|
6224
6385
|
root?: ElementHandle<Node>;
|
6225
6386
|
}
|
6226
6387
|
|
6388
|
+
/* Excluded from this release type: source */
|
6389
|
+
|
6227
6390
|
/**
|
6228
6391
|
* @public
|
6229
6392
|
*/
|
@@ -6330,6 +6493,7 @@ export declare class HTTPResponse {
|
|
6330
6493
|
* which can be opened in Chrome DevTools or {@link https://chromedevtools.github.io/timeline-viewer/ | timeline viewer}.
|
6331
6494
|
*
|
6332
6495
|
* @example
|
6496
|
+
*
|
6333
6497
|
* ```ts
|
6334
6498
|
* await page.tracing.start({path: 'trace.json'});
|
6335
6499
|
* await page.goto('https://www.google.com');
|
@@ -6433,13 +6597,13 @@ export declare class HTTPResponse {
|
|
6433
6597
|
*/
|
6434
6598
|
export declare interface WaitForOptions {
|
6435
6599
|
/**
|
6436
|
-
* Maximum wait time in milliseconds
|
6437
|
-
* disable the timeout.
|
6600
|
+
* Maximum wait time in milliseconds. Pass 0 to disable the timeout.
|
6438
6601
|
*
|
6439
|
-
* @remarks
|
6440
6602
|
* The default value can be changed by using the
|
6441
6603
|
* {@link Page.setDefaultTimeout} or {@link Page.setDefaultNavigationTimeout}
|
6442
6604
|
* methods.
|
6605
|
+
*
|
6606
|
+
* @defaultValue `30000`
|
6443
6607
|
*/
|
6444
6608
|
timeout?: number;
|
6445
6609
|
waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[];
|
@@ -6449,9 +6613,31 @@ export declare class HTTPResponse {
|
|
6449
6613
|
* @public
|
6450
6614
|
*/
|
6451
6615
|
export declare interface WaitForSelectorOptions {
|
6616
|
+
/**
|
6617
|
+
* Wait for the selected element to be present in DOM and to be visible, i.e.
|
6618
|
+
* to not have `display: none` or `visibility: hidden` CSS properties.
|
6619
|
+
*
|
6620
|
+
* @defaultValue `false`
|
6621
|
+
*/
|
6452
6622
|
visible?: boolean;
|
6623
|
+
/**
|
6624
|
+
* Wait for the selected element to not be found in the DOM or to be hidden,
|
6625
|
+
* i.e. have `display: none` or `visibility: hidden` CSS properties.
|
6626
|
+
*
|
6627
|
+
* @defaultValue `false`
|
6628
|
+
*/
|
6453
6629
|
hidden?: boolean;
|
6630
|
+
/**
|
6631
|
+
* Maximum time to wait in milliseconds. Pass `0` to disable timeout.
|
6632
|
+
*
|
6633
|
+
* The default value can be changed by using {@link Page.setDefaultTimeout}
|
6634
|
+
*
|
6635
|
+
* @defaultValue `30000` (30 seconds)
|
6636
|
+
*/
|
6454
6637
|
timeout?: number;
|
6638
|
+
/**
|
6639
|
+
* @deprecated Do not use. Use the {@link ElementHandle.waitForSelector}
|
6640
|
+
*/
|
6455
6641
|
root?: ElementHandle<Node>;
|
6456
6642
|
}
|
6457
6643
|
|
@@ -6475,12 +6661,12 @@ export declare class HTTPResponse {
|
|
6475
6661
|
*/
|
6476
6662
|
export declare interface WaitTimeoutOptions {
|
6477
6663
|
/**
|
6478
|
-
* Maximum wait time in milliseconds
|
6479
|
-
* disable the timeout.
|
6664
|
+
* Maximum wait time in milliseconds. Pass 0 to disable the timeout.
|
6480
6665
|
*
|
6481
|
-
* @remarks
|
6482
6666
|
* The default value can be changed by using the
|
6483
6667
|
* {@link Page.setDefaultTimeout} method.
|
6668
|
+
*
|
6669
|
+
* @defaultValue `30000`
|
6484
6670
|
*/
|
6485
6671
|
timeout?: number;
|
6486
6672
|
}
|
@@ -6488,7 +6674,7 @@ export declare class HTTPResponse {
|
|
6488
6674
|
/* Excluded from this release type: waitWithTimeout */
|
6489
6675
|
|
6490
6676
|
/**
|
6491
|
-
*
|
6677
|
+
* This class represents a
|
6492
6678
|
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API | WebWorker}.
|
6493
6679
|
*
|
6494
6680
|
* @remarks
|
@@ -6496,9 +6682,14 @@ export declare class HTTPResponse {
|
|
6496
6682
|
* object to signal the worker lifecycle.
|
6497
6683
|
*
|
6498
6684
|
* @example
|
6685
|
+
*
|
6499
6686
|
* ```ts
|
6500
|
-
* page.on('workercreated', worker =>
|
6501
|
-
*
|
6687
|
+
* page.on('workercreated', worker =>
|
6688
|
+
* console.log('Worker created: ' + worker.url())
|
6689
|
+
* );
|
6690
|
+
* page.on('workerdestroyed', worker =>
|
6691
|
+
* console.log('Worker destroyed: ' + worker.url())
|
6692
|
+
* );
|
6502
6693
|
*
|
6503
6694
|
* console.log('Current workers:');
|
6504
6695
|
* for (const worker of page.workers()) {
|