brave-real-puppeteer-core 24.26.1 → 24.33.0
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/README.md +5 -5
- package/advanced-stealth.js +1 -1
- package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts +96 -0
- package/lib/cjs/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
- package/lib/cjs/puppeteer/api/BluetoothEmulation.js +8 -0
- package/lib/cjs/puppeteer/api/BluetoothEmulation.js.map +1 -0
- package/lib/cjs/puppeteer/api/Browser.d.ts +111 -2
- package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/Browser.js +4 -2
- package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
- package/lib/cjs/puppeteer/api/BrowserContext.d.ts +5 -3
- package/lib/cjs/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/BrowserContext.js.map +1 -1
- package/lib/cjs/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/CDPSession.js.map +1 -1
- package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts +62 -0
- package/lib/cjs/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -0
- package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js +38 -0
- package/lib/cjs/puppeteer/api/DeviceRequestPrompt.js.map +1 -0
- package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
- package/lib/cjs/puppeteer/api/Frame.d.ts +1 -1
- package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/api/Page.d.ts +39 -5
- package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/Page.js.map +1 -1
- package/lib/cjs/puppeteer/api/api.d.ts +2 -0
- package/lib/cjs/puppeteer/api/api.d.ts.map +1 -1
- package/lib/cjs/puppeteer/api/api.js +1 -0
- package/lib/cjs/puppeteer/api/api.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/BidiOverCdp.js +1 -1
- package/lib/cjs/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
- package/lib/cjs/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
- package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js +42 -0
- package/lib/cjs/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
- package/lib/cjs/puppeteer/bidi/Browser.d.ts +6 -1
- package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Browser.js +16 -0
- package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/BrowserConnector.js +4 -3
- package/lib/cjs/puppeteer/bidi/BrowserConnector.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts +3 -3
- package/lib/cjs/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/BrowserContext.js +6 -3
- package/lib/cjs/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/Connection.d.ts +2 -1
- package/lib/cjs/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Connection.js +3 -2
- package/lib/cjs/puppeteer/bidi/Connection.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
- package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
- package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js +90 -0
- package/lib/cjs/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
- package/lib/cjs/puppeteer/bidi/Frame.d.ts +3 -1
- package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Frame.js +3 -2
- package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts +0 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/HTTPRequest.js +0 -25
- package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/Page.d.ts +10 -8
- package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/Page.js +63 -47
- package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +8 -0
- package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +55 -2
- package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Connection.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +1 -12
- package/lib/cjs/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/util.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/util.js +7 -0
- package/lib/cjs/puppeteer/bidi/util.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/Accessibility.d.ts +6 -0
- package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Accessibility.js +11 -3
- package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
- package/lib/cjs/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
- package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js +30 -0
- package/lib/cjs/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
- package/lib/cjs/puppeteer/cdp/Browser.d.ts +10 -5
- package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Browser.js +61 -8
- package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/BrowserConnector.js +4 -2
- package/lib/cjs/puppeteer/cdp/BrowserConnector.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts +3 -2
- package/lib/cjs/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/BrowserContext.js +4 -4
- package/lib/cjs/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/CdpSession.d.ts +1 -1
- package/lib/cjs/puppeteer/cdp/CdpSession.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/CdpSession.js +2 -1
- package/lib/cjs/puppeteer/cdp/CdpSession.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/Connection.d.ts +6 -1
- package/lib/cjs/puppeteer/cdp/Connection.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Connection.js +11 -2
- package/lib/cjs/puppeteer/cdp/Connection.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts +5 -64
- package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js +10 -76
- package/lib/cjs/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts +1 -0
- package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/EmulationManager.js +22 -0
- package/lib/cjs/puppeteer/cdp/EmulationManager.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/ExtensionTransport.js +5 -1
- package/lib/cjs/puppeteer/cdp/ExtensionTransport.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/Frame.d.ts +1 -1
- package/lib/cjs/puppeteer/cdp/Frame.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/FrameManager.d.ts +2 -2
- package/lib/cjs/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/FrameManager.js +1 -1
- package/lib/cjs/puppeteer/cdp/FrameManager.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js +4 -1
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
- package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/NetworkEventManager.js +8 -0
- package/lib/cjs/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/NetworkManager.js +25 -1
- package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/Page.d.ts +9 -4
- package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Page.js +29 -6
- package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/TargetManager.d.ts +1 -1
- package/lib/cjs/puppeteer/cdp/TargetManager.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/TargetManager.js +29 -27
- package/lib/cjs/puppeteer/cdp/TargetManager.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/WebWorker.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/WebWorker.js +8 -3
- package/lib/cjs/puppeteer/cdp/WebWorker.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/cdp.d.ts +1 -0
- package/lib/cjs/puppeteer/cdp/cdp.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/cdp.js +1 -0
- package/lib/cjs/puppeteer/cdp/cdp.js.map +1 -1
- package/lib/cjs/puppeteer/common/BrowserConnector.js +47 -3
- package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
- package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +2 -0
- package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
- package/lib/cjs/puppeteer/common/CallbackRegistry.js +4 -3
- package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/lib/cjs/puppeteer/common/ConnectOptions.d.ts +22 -0
- package/lib/cjs/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +8 -1
- package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/lib/cjs/puppeteer/common/ConsoleMessage.js +11 -1
- package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts +4 -0
- package/lib/cjs/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/BrowserLauncher.js +10 -4
- package/lib/cjs/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts +1 -1
- package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/ChromeLauncher.js +2 -13
- package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/lib/cjs/puppeteer/node/LaunchOptions.d.ts +5 -3
- package/lib/cjs/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/lib/cjs/puppeteer/node/LaunchOptions.js +17 -0
- package/lib/cjs/puppeteer/node/LaunchOptions.js.map +1 -1
- package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/lib/cjs/puppeteer/revisions.js +3 -3
- package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/lib/cjs/puppeteer/util/disposable.d.ts +2 -2
- package/lib/cjs/puppeteer/util/disposable.d.ts.map +1 -1
- package/lib/cjs/puppeteer/util/disposable.js +3 -1
- package/lib/cjs/puppeteer/util/disposable.js.map +1 -1
- package/lib/cjs/puppeteer/util/util.d.ts +1 -0
- package/lib/cjs/puppeteer/util/util.d.ts.map +1 -1
- package/lib/cjs/puppeteer/util/util.js +1 -0
- package/lib/cjs/puppeteer/util/util.js.map +1 -1
- package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/lib/cjs/puppeteer/util/version.js +1 -1
- package/lib/es5-iife/puppeteer-core-browser.d.ts +297 -19
- package/lib/es5-iife/puppeteer-core-browser.js +456 -215
- package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts +96 -0
- package/lib/esm/puppeteer/api/BluetoothEmulation.d.ts.map +1 -0
- package/lib/esm/puppeteer/api/BluetoothEmulation.js +7 -0
- package/lib/esm/puppeteer/api/BluetoothEmulation.js.map +1 -0
- package/lib/esm/puppeteer/api/Browser.d.ts +111 -2
- package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Browser.js +4 -2
- package/lib/esm/puppeteer/api/Browser.js.map +1 -1
- package/lib/esm/puppeteer/api/BrowserContext.d.ts +5 -3
- package/lib/esm/puppeteer/api/BrowserContext.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/BrowserContext.js.map +1 -1
- package/lib/esm/puppeteer/api/CDPSession.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/CDPSession.js.map +1 -1
- package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts +62 -0
- package/lib/esm/puppeteer/api/DeviceRequestPrompt.d.ts.map +1 -0
- package/lib/esm/puppeteer/api/DeviceRequestPrompt.js +34 -0
- package/lib/esm/puppeteer/api/DeviceRequestPrompt.js.map +1 -0
- package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
- package/lib/esm/puppeteer/api/Frame.d.ts +1 -1
- package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Frame.js.map +1 -1
- package/lib/esm/puppeteer/api/Input.d.ts +1 -1
- package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Page.d.ts +39 -5
- package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/Page.js.map +1 -1
- package/lib/esm/puppeteer/api/api.d.ts +2 -0
- package/lib/esm/puppeteer/api/api.d.ts.map +1 -1
- package/lib/esm/puppeteer/api/api.js +1 -0
- package/lib/esm/puppeteer/api/api.js.map +1 -1
- package/lib/esm/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/BidiOverCdp.js +1 -1
- package/lib/esm/puppeteer/bidi/BidiOverCdp.js.map +1 -1
- package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts +18 -0
- package/lib/esm/puppeteer/bidi/BluetoothEmulation.d.ts.map +1 -0
- package/lib/esm/puppeteer/bidi/BluetoothEmulation.js +38 -0
- package/lib/esm/puppeteer/bidi/BluetoothEmulation.js.map +1 -0
- package/lib/esm/puppeteer/bidi/Browser.d.ts +6 -1
- package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Browser.js +16 -0
- package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
- package/lib/esm/puppeteer/bidi/BrowserConnector.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/BrowserConnector.js +4 -3
- package/lib/esm/puppeteer/bidi/BrowserConnector.js.map +1 -1
- package/lib/esm/puppeteer/bidi/BrowserContext.d.ts +3 -3
- package/lib/esm/puppeteer/bidi/BrowserContext.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/BrowserContext.js +6 -3
- package/lib/esm/puppeteer/bidi/BrowserContext.js.map +1 -1
- package/lib/esm/puppeteer/bidi/Connection.d.ts +2 -1
- package/lib/esm/puppeteer/bidi/Connection.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Connection.js +3 -2
- package/lib/esm/puppeteer/bidi/Connection.js.map +1 -1
- package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts +27 -0
- package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.d.ts.map +1 -0
- package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js +85 -0
- package/lib/esm/puppeteer/bidi/DeviceRequestPrompt.js.map +1 -0
- package/lib/esm/puppeteer/bidi/Frame.d.ts +3 -1
- package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Frame.js +3 -2
- package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts +0 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/HTTPRequest.js +0 -25
- package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/bidi/Page.d.ts +10 -8
- package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/Page.js +64 -48
- package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
- package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +8 -0
- package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +55 -2
- package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Connection.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Realm.d.ts +1 -12
- package/lib/esm/puppeteer/bidi/core/Realm.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/util.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/util.js +7 -0
- package/lib/esm/puppeteer/bidi/util.js.map +1 -1
- package/lib/esm/puppeteer/cdp/Accessibility.d.ts +6 -0
- package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Accessibility.js +11 -3
- package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
- package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts +18 -0
- package/lib/esm/puppeteer/cdp/BluetoothEmulation.d.ts.map +1 -0
- package/lib/esm/puppeteer/cdp/BluetoothEmulation.js +26 -0
- package/lib/esm/puppeteer/cdp/BluetoothEmulation.js.map +1 -0
- package/lib/esm/puppeteer/cdp/Browser.d.ts +10 -5
- package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Browser.js +61 -8
- package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
- package/lib/esm/puppeteer/cdp/BrowserConnector.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/BrowserConnector.js +4 -2
- package/lib/esm/puppeteer/cdp/BrowserConnector.js.map +1 -1
- package/lib/esm/puppeteer/cdp/BrowserContext.d.ts +3 -2
- package/lib/esm/puppeteer/cdp/BrowserContext.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/BrowserContext.js +4 -4
- package/lib/esm/puppeteer/cdp/BrowserContext.js.map +1 -1
- package/lib/esm/puppeteer/cdp/CdpSession.d.ts +1 -1
- package/lib/esm/puppeteer/cdp/CdpSession.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/CdpSession.js +2 -1
- package/lib/esm/puppeteer/cdp/CdpSession.js.map +1 -1
- package/lib/esm/puppeteer/cdp/Connection.d.ts +6 -1
- package/lib/esm/puppeteer/cdp/Connection.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Connection.js +11 -2
- package/lib/esm/puppeteer/cdp/Connection.js.map +1 -1
- package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts +5 -64
- package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js +7 -72
- package/lib/esm/puppeteer/cdp/DeviceRequestPrompt.js.map +1 -1
- package/lib/esm/puppeteer/cdp/EmulationManager.d.ts +1 -0
- package/lib/esm/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/EmulationManager.js +22 -0
- package/lib/esm/puppeteer/cdp/EmulationManager.js.map +1 -1
- package/lib/esm/puppeteer/cdp/ExtensionTransport.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/ExtensionTransport.js +5 -1
- package/lib/esm/puppeteer/cdp/ExtensionTransport.js.map +1 -1
- package/lib/esm/puppeteer/cdp/Frame.d.ts +1 -1
- package/lib/esm/puppeteer/cdp/Frame.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Frame.js.map +1 -1
- package/lib/esm/puppeteer/cdp/FrameManager.d.ts +2 -2
- package/lib/esm/puppeteer/cdp/FrameManager.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/FrameManager.js +2 -2
- package/lib/esm/puppeteer/cdp/FrameManager.js.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.js +4 -1
- package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
- package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/NetworkEventManager.js +8 -0
- package/lib/esm/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/NetworkManager.js +25 -1
- package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/lib/esm/puppeteer/cdp/Page.d.ts +9 -4
- package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Page.js +29 -6
- package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
- package/lib/esm/puppeteer/cdp/TargetManager.d.ts +1 -1
- package/lib/esm/puppeteer/cdp/TargetManager.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/TargetManager.js +30 -28
- package/lib/esm/puppeteer/cdp/TargetManager.js.map +1 -1
- package/lib/esm/puppeteer/cdp/WebWorker.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/WebWorker.js +8 -3
- package/lib/esm/puppeteer/cdp/WebWorker.js.map +1 -1
- package/lib/esm/puppeteer/cdp/cdp.d.ts +1 -0
- package/lib/esm/puppeteer/cdp/cdp.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/cdp.js +1 -0
- package/lib/esm/puppeteer/cdp/cdp.js.map +1 -1
- package/lib/esm/puppeteer/common/BrowserConnector.js +48 -4
- package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
- package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +2 -0
- package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
- package/lib/esm/puppeteer/common/CallbackRegistry.js +4 -3
- package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
- package/lib/esm/puppeteer/common/ConnectOptions.d.ts +22 -0
- package/lib/esm/puppeteer/common/ConnectOptions.d.ts.map +1 -1
- package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +8 -1
- package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
- package/lib/esm/puppeteer/common/ConsoleMessage.js +11 -1
- package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
- package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.d.ts +4 -0
- package/lib/esm/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/BrowserLauncher.js +10 -4
- package/lib/esm/puppeteer/node/BrowserLauncher.js.map +1 -1
- package/lib/esm/puppeteer/node/ChromeLauncher.d.ts +1 -1
- package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/ChromeLauncher.js +2 -13
- package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
- package/lib/esm/puppeteer/node/LaunchOptions.d.ts +5 -3
- package/lib/esm/puppeteer/node/LaunchOptions.d.ts.map +1 -1
- package/lib/esm/puppeteer/node/LaunchOptions.js +16 -1
- package/lib/esm/puppeteer/node/LaunchOptions.js.map +1 -1
- package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/lib/esm/puppeteer/revisions.js +3 -3
- package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/lib/esm/puppeteer/util/disposable.d.ts +2 -2
- package/lib/esm/puppeteer/util/disposable.d.ts.map +1 -1
- package/lib/esm/puppeteer/util/disposable.js +2 -2
- package/lib/esm/puppeteer/util/disposable.js.map +1 -1
- package/lib/esm/puppeteer/util/util.d.ts +1 -0
- package/lib/esm/puppeteer/util/util.d.ts.map +1 -1
- package/lib/esm/puppeteer/util/util.js +1 -0
- package/lib/esm/puppeteer/util/util.js.map +1 -1
- package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/lib/esm/puppeteer/util/version.js +1 -1
- package/lib/types.d.ts +297 -19
- package/package.json +15 -15
- package/src/api/BluetoothEmulation.ts +103 -0
- package/src/api/Browser.ts +130 -3
- package/src/api/BrowserContext.ts +10 -3
- package/src/api/CDPSession.ts +1 -2
- package/src/api/DeviceRequestPrompt.ts +71 -0
- package/src/api/ElementHandle.ts +2 -4
- package/src/api/Frame.ts +3 -5
- package/src/api/Page.ts +46 -9
- package/src/api/api.ts +2 -0
- package/src/bidi/BidiOverCdp.ts +1 -0
- package/src/bidi/BluetoothEmulation.ts +52 -0
- package/src/bidi/Browser.ts +28 -0
- package/src/bidi/BrowserConnector.ts +8 -1
- package/src/bidi/BrowserContext.ts +9 -6
- package/src/bidi/Connection.ts +4 -1
- package/src/bidi/DeviceRequestPrompt.ts +138 -0
- package/src/bidi/Frame.ts +7 -3
- package/src/bidi/HTTPRequest.ts +0 -41
- package/src/bidi/Page.ts +86 -71
- package/src/bidi/core/BrowsingContext.ts +80 -2
- package/src/bidi/core/Connection.ts +3 -2
- package/src/bidi/util.ts +8 -0
- package/src/cdp/Accessibility.ts +17 -3
- package/src/cdp/BluetoothEmulation.ts +47 -0
- package/src/cdp/Browser.ts +95 -10
- package/src/cdp/BrowserConnector.ts +4 -0
- package/src/cdp/BrowserContext.ts +5 -4
- package/src/cdp/CdpSession.ts +3 -2
- package/src/cdp/Connection.ts +15 -1
- package/src/cdp/DeviceRequestPrompt.ts +8 -79
- package/src/cdp/EmulationManager.ts +30 -0
- package/src/cdp/ExtensionTransport.ts +5 -1
- package/src/cdp/Frame.ts +3 -5
- package/src/cdp/FrameManager.ts +9 -4
- package/src/cdp/HTTPRequest.ts +5 -1
- package/src/cdp/NetworkEventManager.ts +16 -1
- package/src/cdp/NetworkManager.ts +31 -1
- package/src/cdp/Page.ts +48 -13
- package/src/cdp/TargetManager.ts +36 -43
- package/src/cdp/WebWorker.ts +8 -3
- package/src/cdp/cdp.ts +1 -0
- package/src/common/BrowserConnector.ts +67 -4
- package/src/common/CallbackRegistry.ts +7 -5
- package/src/common/ConnectOptions.ts +28 -0
- package/src/common/ConsoleMessage.ts +14 -0
- package/src/common/EventEmitter.ts +3 -3
- package/src/node/BrowserLauncher.ts +22 -1
- package/src/node/ChromeLauncher.ts +5 -17
- package/src/node/LaunchOptions.ts +23 -7
- package/src/revisions.ts +3 -3
- package/src/util/disposable.ts +2 -2
- package/src/util/util.ts +1 -0
- package/src/util/version.ts +1 -1
- package/src/templates/version.ts.tmpl +0 -4
|
@@ -6,9 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
import type * as Bidi from 'webdriver-bidi-protocol';
|
|
8
8
|
|
|
9
|
+
import type {BluetoothEmulation} from '../../api/BluetoothEmulation.js';
|
|
10
|
+
import type {DeviceRequestPrompt} from '../../api/DeviceRequestPrompt.js';
|
|
9
11
|
import {EventEmitter} from '../../common/EventEmitter.js';
|
|
12
|
+
import {isString} from '../../common/util.js';
|
|
13
|
+
import {assert} from '../../util/assert.js';
|
|
10
14
|
import {inertIfDisposed, throwIfDisposed} from '../../util/decorators.js';
|
|
11
15
|
import {DisposableStack, disposeSymbol} from '../../util/disposable.js';
|
|
16
|
+
import {BidiBluetoothEmulation} from '../BluetoothEmulation.js';
|
|
17
|
+
import {BidiDeviceRequestPromptManager} from '../DeviceRequestPrompt.js';
|
|
12
18
|
|
|
13
19
|
import type {AddPreloadScriptOptions} from './Browser.js';
|
|
14
20
|
import {Navigation} from './Navigation.js';
|
|
@@ -161,9 +167,11 @@ export class BrowsingContext extends EventEmitter<{
|
|
|
161
167
|
readonly #emulationState: {
|
|
162
168
|
javaScriptEnabled: boolean;
|
|
163
169
|
} = {javaScriptEnabled: true};
|
|
170
|
+
readonly #bluetoothEmulation: BluetoothEmulation;
|
|
171
|
+
readonly #deviceRequestPromptManager: BidiDeviceRequestPromptManager;
|
|
164
172
|
|
|
165
173
|
private constructor(
|
|
166
|
-
|
|
174
|
+
userContext: UserContext,
|
|
167
175
|
parent: BrowsingContext | undefined,
|
|
168
176
|
id: string,
|
|
169
177
|
url: string,
|
|
@@ -174,10 +182,18 @@ export class BrowsingContext extends EventEmitter<{
|
|
|
174
182
|
this.#url = url;
|
|
175
183
|
this.id = id;
|
|
176
184
|
this.parent = parent;
|
|
177
|
-
this.userContext =
|
|
185
|
+
this.userContext = userContext;
|
|
178
186
|
this.originalOpener = originalOpener;
|
|
179
187
|
|
|
180
188
|
this.defaultRealm = this.#createWindowRealm();
|
|
189
|
+
this.#bluetoothEmulation = new BidiBluetoothEmulation(
|
|
190
|
+
this.id,
|
|
191
|
+
this.#session,
|
|
192
|
+
);
|
|
193
|
+
this.#deviceRequestPromptManager = new BidiDeviceRequestPromptManager(
|
|
194
|
+
this.id,
|
|
195
|
+
this.#session,
|
|
196
|
+
);
|
|
181
197
|
}
|
|
182
198
|
|
|
183
199
|
#initialize() {
|
|
@@ -601,6 +617,19 @@ export class BrowsingContext extends EventEmitter<{
|
|
|
601
617
|
);
|
|
602
618
|
}
|
|
603
619
|
|
|
620
|
+
@throwIfDisposed<BrowsingContext>(context => {
|
|
621
|
+
// SAFETY: Disposal implies this exists.
|
|
622
|
+
return context.#reason!;
|
|
623
|
+
})
|
|
624
|
+
async setScreenOrientationOverride(
|
|
625
|
+
screenOrientation: Bidi.Emulation.ScreenOrientation | null,
|
|
626
|
+
): Promise<void> {
|
|
627
|
+
await this.#session.send('emulation.setScreenOrientationOverride', {
|
|
628
|
+
screenOrientation,
|
|
629
|
+
contexts: [this.id],
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
|
|
604
633
|
@throwIfDisposed<BrowsingContext>(context => {
|
|
605
634
|
// SAFETY: Disposal implies this exists.
|
|
606
635
|
return context.#reason!;
|
|
@@ -726,4 +755,53 @@ export class BrowsingContext extends EventEmitter<{
|
|
|
726
755
|
isJavaScriptEnabled(): boolean {
|
|
727
756
|
return this.#emulationState.javaScriptEnabled;
|
|
728
757
|
}
|
|
758
|
+
|
|
759
|
+
async setUserAgent(userAgent: string | null): Promise<void> {
|
|
760
|
+
await this.#session.send('emulation.setUserAgentOverride', {
|
|
761
|
+
userAgent,
|
|
762
|
+
contexts: [this.id],
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
async setOfflineMode(enabled: boolean): Promise<void> {
|
|
767
|
+
await this.#session.send('emulation.setNetworkConditions', {
|
|
768
|
+
networkConditions: enabled
|
|
769
|
+
? {
|
|
770
|
+
type: 'offline',
|
|
771
|
+
}
|
|
772
|
+
: null,
|
|
773
|
+
contexts: [this.id],
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
get bluetooth(): BluetoothEmulation {
|
|
778
|
+
return this.#bluetoothEmulation;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
async waitForDevicePrompt(
|
|
782
|
+
timeout: number,
|
|
783
|
+
signal?: AbortSignal,
|
|
784
|
+
): Promise<DeviceRequestPrompt> {
|
|
785
|
+
return await this.#deviceRequestPromptManager.waitForDevicePrompt(
|
|
786
|
+
timeout,
|
|
787
|
+
signal,
|
|
788
|
+
);
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
async setExtraHTTPHeaders(headers: Record<string, string>): Promise<void> {
|
|
792
|
+
await this.#session.send('network.setExtraHeaders', {
|
|
793
|
+
headers: Object.entries(headers).map(([key, value]) => {
|
|
794
|
+
assert(
|
|
795
|
+
isString(value),
|
|
796
|
+
`Expected value of header "${key}" to be String, but "${typeof value}" is found.`,
|
|
797
|
+
);
|
|
798
|
+
|
|
799
|
+
return {
|
|
800
|
+
name: key.toLowerCase(),
|
|
801
|
+
value: {type: 'string', value: value},
|
|
802
|
+
};
|
|
803
|
+
}),
|
|
804
|
+
contexts: [this.id],
|
|
805
|
+
});
|
|
806
|
+
}
|
|
729
807
|
}
|
|
@@ -21,8 +21,9 @@ export type BidiEvents = {
|
|
|
21
21
|
/**
|
|
22
22
|
* @internal
|
|
23
23
|
*/
|
|
24
|
-
export interface Connection<
|
|
25
|
-
extends
|
|
24
|
+
export interface Connection<
|
|
25
|
+
Events extends BidiEvents = BidiEvents,
|
|
26
|
+
> extends EventEmitter<Events> {
|
|
26
27
|
send<T extends keyof Commands>(
|
|
27
28
|
method: T,
|
|
28
29
|
params: Commands[T]['params'],
|
package/src/bidi/util.ts
CHANGED
|
@@ -17,6 +17,14 @@ import {BidiDeserializer} from './Deserializer.js';
|
|
|
17
17
|
export function createEvaluationError(
|
|
18
18
|
details: Bidi.Script.ExceptionDetails,
|
|
19
19
|
): unknown {
|
|
20
|
+
if (details.exception.type === 'object' && !('value' in details.exception)) {
|
|
21
|
+
// Heuristic detecting a platform object was thrown. WebDriver BiDi serializes
|
|
22
|
+
// platform objects without value. If so, throw a generic error with the actual
|
|
23
|
+
// exception's message, as there is no way to restore the original exception's
|
|
24
|
+
// constructor.
|
|
25
|
+
return new Error(details.text);
|
|
26
|
+
}
|
|
27
|
+
|
|
20
28
|
if (details.exception.type !== 'error') {
|
|
21
29
|
return BidiDeserializer.deserialize(details.exception);
|
|
22
30
|
}
|
package/src/cdp/Accessibility.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type {Protocol} from 'devtools-protocol';
|
|
|
8
8
|
|
|
9
9
|
import type {ElementHandle} from '../api/ElementHandle.js';
|
|
10
10
|
import type {Realm} from '../api/Realm.js';
|
|
11
|
+
import {debugError} from '../common/util.js';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Represents a Node and the properties of it that are relevant to Accessibility.
|
|
@@ -86,6 +87,13 @@ export interface SerializedAXNode {
|
|
|
86
87
|
*/
|
|
87
88
|
children?: SerializedAXNode[];
|
|
88
89
|
|
|
90
|
+
/**
|
|
91
|
+
* CDP-specifc ID to reference the DOM node.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
backendNodeId?: number;
|
|
96
|
+
|
|
89
97
|
/**
|
|
90
98
|
* Get an ElementHandle for this AXNode if available.
|
|
91
99
|
*
|
|
@@ -231,8 +239,13 @@ export class Accessibility {
|
|
|
231
239
|
if (!frame) {
|
|
232
240
|
return;
|
|
233
241
|
}
|
|
234
|
-
|
|
235
|
-
|
|
242
|
+
try {
|
|
243
|
+
const iframeSnapshot = await frame.accessibility.snapshot(options);
|
|
244
|
+
root.iframeSnapshot = iframeSnapshot ?? undefined;
|
|
245
|
+
} catch (error) {
|
|
246
|
+
// Frames can get detached at any time resulting in errors.
|
|
247
|
+
debugError(error);
|
|
248
|
+
}
|
|
236
249
|
}
|
|
237
250
|
for (const child of root.children) {
|
|
238
251
|
await populateIframes(child);
|
|
@@ -539,6 +552,7 @@ class AXNode {
|
|
|
539
552
|
return node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
|
540
553
|
})) as ElementHandle<Element>;
|
|
541
554
|
},
|
|
555
|
+
backendNodeId: this.payload.backendDOMNodeId,
|
|
542
556
|
};
|
|
543
557
|
|
|
544
558
|
type UserStringProperty =
|
|
@@ -604,7 +618,7 @@ class AXNode {
|
|
|
604
618
|
continue;
|
|
605
619
|
}
|
|
606
620
|
const value = getBooleanPropertyValue(booleanProperty);
|
|
607
|
-
if (
|
|
621
|
+
if (value === undefined) {
|
|
608
622
|
continue;
|
|
609
623
|
}
|
|
610
624
|
node[booleanProperty] = getBooleanPropertyValue(booleanProperty);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type {
|
|
7
|
+
AdapterState,
|
|
8
|
+
BluetoothEmulation,
|
|
9
|
+
PreconnectedPeripheral,
|
|
10
|
+
} from '../api/BluetoothEmulation.js';
|
|
11
|
+
|
|
12
|
+
import type {Connection} from './Connection.js';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export class CdpBluetoothEmulation implements BluetoothEmulation {
|
|
18
|
+
#connection: Connection;
|
|
19
|
+
|
|
20
|
+
constructor(connection: Connection) {
|
|
21
|
+
this.#connection = connection;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async emulateAdapter(state: AdapterState, leSupported = true): Promise<void> {
|
|
25
|
+
// Bluetooth spec requires overriding the existing adapter (step 6). From the CDP
|
|
26
|
+
// perspective, it means disabling the emulation first.
|
|
27
|
+
// https://webbluetoothcg.github.io/web-bluetooth/#bluetooth-simulateAdapter-command
|
|
28
|
+
await this.#connection.send('BluetoothEmulation.disable');
|
|
29
|
+
await this.#connection.send('BluetoothEmulation.enable', {
|
|
30
|
+
state,
|
|
31
|
+
leSupported,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async disableEmulation(): Promise<void> {
|
|
36
|
+
await this.#connection.send('BluetoothEmulation.disable');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async simulatePreconnectedPeripheral(
|
|
40
|
+
preconnectedPeripheral: PreconnectedPeripheral,
|
|
41
|
+
): Promise<void> {
|
|
42
|
+
await this.#connection.send(
|
|
43
|
+
'BluetoothEmulation.simulatePreconnectedPeripheral',
|
|
44
|
+
preconnectedPeripheral,
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
}
|
package/src/cdp/Browser.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type {ChildProcess} from 'node:child_process';
|
|
|
8
8
|
|
|
9
9
|
import type {Protocol} from 'devtools-protocol';
|
|
10
10
|
|
|
11
|
-
import type {DebugInfo} from '../api/Browser.js';
|
|
11
|
+
import type {CreatePageOptions, DebugInfo} from '../api/Browser.js';
|
|
12
12
|
import {
|
|
13
13
|
Browser as BrowserBase,
|
|
14
14
|
BrowserEvent,
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
type BrowserContextOptions,
|
|
17
17
|
type IsPageTargetCallback,
|
|
18
18
|
type TargetFilterCallback,
|
|
19
|
+
type ScreenInfo,
|
|
20
|
+
type AddScreenParams,
|
|
21
|
+
type WindowBounds,
|
|
22
|
+
type WindowId,
|
|
19
23
|
} from '../api/Browser.js';
|
|
20
24
|
import {BrowserContextEvent} from '../api/BrowserContext.js';
|
|
21
25
|
import {CDPSessionEvent} from '../api/CDPSession.js';
|
|
@@ -196,7 +200,9 @@ export class CdpBrowser extends BrowserBase {
|
|
|
196
200
|
target.type() === 'webview' ||
|
|
197
201
|
(this.#handleDevToolsAsPage &&
|
|
198
202
|
target.type() === 'other' &&
|
|
199
|
-
target
|
|
203
|
+
target
|
|
204
|
+
.url()
|
|
205
|
+
.startsWith('devtools://devtools/bundled/devtools_app.html'))
|
|
200
206
|
);
|
|
201
207
|
});
|
|
202
208
|
}
|
|
@@ -343,19 +349,30 @@ export class CdpBrowser extends BrowserBase {
|
|
|
343
349
|
return this.#connection.url();
|
|
344
350
|
}
|
|
345
351
|
|
|
346
|
-
override async newPage(): Promise<Page> {
|
|
347
|
-
return await this.#defaultContext.newPage();
|
|
352
|
+
override async newPage(options?: CreatePageOptions): Promise<Page> {
|
|
353
|
+
return await this.#defaultContext.newPage(options);
|
|
348
354
|
}
|
|
349
355
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
+
async _createPageInContext(
|
|
357
|
+
contextId?: string,
|
|
358
|
+
options?: CreatePageOptions,
|
|
359
|
+
): Promise<Page> {
|
|
360
|
+
const hasTargets =
|
|
361
|
+
this.targets().filter(t => {
|
|
362
|
+
return t.browserContext().id === contextId;
|
|
363
|
+
}).length > 0;
|
|
364
|
+
const windowBounds =
|
|
365
|
+
options?.type === 'window' ? options.windowBounds : undefined;
|
|
356
366
|
const {targetId} = await this.#connection.send('Target.createTarget', {
|
|
357
367
|
url: 'about:blank',
|
|
358
368
|
browserContextId: contextId || undefined,
|
|
369
|
+
left: windowBounds?.left,
|
|
370
|
+
top: windowBounds?.top,
|
|
371
|
+
width: windowBounds?.width,
|
|
372
|
+
height: windowBounds?.height,
|
|
373
|
+
windowState: windowBounds?.windowState,
|
|
374
|
+
// Works around crbug.com/454825274.
|
|
375
|
+
newWindow: hasTargets && options?.type === 'window' ? true : undefined,
|
|
359
376
|
});
|
|
360
377
|
const target = (await this.waitForTarget(t => {
|
|
361
378
|
return (t as CdpTarget)._targetId === targetId;
|
|
@@ -378,6 +395,38 @@ export class CdpBrowser extends BrowserBase {
|
|
|
378
395
|
return page;
|
|
379
396
|
}
|
|
380
397
|
|
|
398
|
+
async _createDevToolsPage(pageTargetId: string): Promise<Page> {
|
|
399
|
+
const openDevToolsResponse = await this.#connection.send(
|
|
400
|
+
'Target.openDevTools',
|
|
401
|
+
{
|
|
402
|
+
targetId: pageTargetId,
|
|
403
|
+
},
|
|
404
|
+
);
|
|
405
|
+
const target = (await this.waitForTarget(t => {
|
|
406
|
+
return (t as CdpTarget)._targetId === openDevToolsResponse.targetId;
|
|
407
|
+
})) as CdpTarget;
|
|
408
|
+
if (!target) {
|
|
409
|
+
throw new Error(
|
|
410
|
+
`Missing target for DevTools page (id = ${pageTargetId})`,
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
const initialized =
|
|
414
|
+
(await target._initializedDeferred.valueOrThrow()) ===
|
|
415
|
+
InitializationStatus.SUCCESS;
|
|
416
|
+
if (!initialized) {
|
|
417
|
+
throw new Error(
|
|
418
|
+
`Failed to create target for DevTools page (id = ${pageTargetId})`,
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
const page = await target.page();
|
|
422
|
+
if (!page) {
|
|
423
|
+
throw new Error(
|
|
424
|
+
`Failed to create a DevTools Page for target (id = ${pageTargetId})`,
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
return page;
|
|
428
|
+
}
|
|
429
|
+
|
|
381
430
|
override async installExtension(path: string): Promise<string> {
|
|
382
431
|
const {id} = await this.#connection.send('Extensions.loadUnpacked', {path});
|
|
383
432
|
return id;
|
|
@@ -387,6 +436,42 @@ export class CdpBrowser extends BrowserBase {
|
|
|
387
436
|
return this.#connection.send('Extensions.uninstall', {id});
|
|
388
437
|
}
|
|
389
438
|
|
|
439
|
+
override async screens(): Promise<ScreenInfo[]> {
|
|
440
|
+
const {screenInfos} = await this.#connection.send(
|
|
441
|
+
'Emulation.getScreenInfos',
|
|
442
|
+
);
|
|
443
|
+
return screenInfos;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
override async addScreen(params: AddScreenParams): Promise<ScreenInfo> {
|
|
447
|
+
const {screenInfo} = await this.#connection.send(
|
|
448
|
+
'Emulation.addScreen',
|
|
449
|
+
params,
|
|
450
|
+
);
|
|
451
|
+
return screenInfo;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
override async removeScreen(screenId: string): Promise<void> {
|
|
455
|
+
return await this.#connection.send('Emulation.removeScreen', {screenId});
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
override async getWindowBounds(windowId: WindowId): Promise<WindowBounds> {
|
|
459
|
+
const {bounds} = await this.#connection.send('Browser.getWindowBounds', {
|
|
460
|
+
windowId: Number(windowId),
|
|
461
|
+
});
|
|
462
|
+
return bounds;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
override async setWindowBounds(
|
|
466
|
+
windowId: WindowId,
|
|
467
|
+
windowBounds: WindowBounds,
|
|
468
|
+
): Promise<void> {
|
|
469
|
+
await this.#connection.send('Browser.setWindowBounds', {
|
|
470
|
+
windowId: Number(windowId),
|
|
471
|
+
bounds: windowBounds,
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
|
|
390
475
|
override targets(): CdpTarget[] {
|
|
391
476
|
return Array.from(
|
|
392
477
|
this.#targetManager.getAvailableTargets().values(),
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import type {ConnectionTransport} from '../common/ConnectionTransport.js';
|
|
8
8
|
import type {ConnectOptions} from '../common/ConnectOptions.js';
|
|
9
9
|
import {debugError, DEFAULT_VIEWPORT} from '../common/util.js';
|
|
10
|
+
import {createIncrementalIdGenerator} from '../util/incremental-id-generator.js';
|
|
10
11
|
|
|
11
12
|
import {CdpBrowser} from './Browser.js';
|
|
12
13
|
import {Connection} from './Connection.js';
|
|
@@ -32,6 +33,7 @@ export async function _connectToCdpBrowser(
|
|
|
32
33
|
slowMo = 0,
|
|
33
34
|
protocolTimeout,
|
|
34
35
|
handleDevToolsAsPage,
|
|
36
|
+
idGenerator = createIncrementalIdGenerator(),
|
|
35
37
|
} = options;
|
|
36
38
|
|
|
37
39
|
const connection = new Connection(
|
|
@@ -39,6 +41,8 @@ export async function _connectToCdpBrowser(
|
|
|
39
41
|
connectionTransport,
|
|
40
42
|
slowMo,
|
|
41
43
|
protocolTimeout,
|
|
44
|
+
/* rawErrors */ false,
|
|
45
|
+
idGenerator,
|
|
42
46
|
);
|
|
43
47
|
|
|
44
48
|
const {browserContextIds} = await connection.send(
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
import type {CreatePageOptions} from '../api/Browser.js';
|
|
7
8
|
import {
|
|
8
9
|
WEB_PERMISSION_TO_PROTOCOL_PERMISSION,
|
|
9
10
|
type Permission,
|
|
@@ -44,13 +45,13 @@ export class CdpBrowserContext extends BrowserContext {
|
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
override async pages(): Promise<Page[]> {
|
|
48
|
+
override async pages(includeAll = false): Promise<Page[]> {
|
|
48
49
|
const pages = await Promise.all(
|
|
49
50
|
this.targets()
|
|
50
51
|
.filter(target => {
|
|
51
52
|
return (
|
|
52
53
|
target.type() === 'page' ||
|
|
53
|
-
(target.type() === 'other' &&
|
|
54
|
+
((target.type() === 'other' || includeAll) &&
|
|
54
55
|
this.#browser._getIsPageTargetCallback()?.(target))
|
|
55
56
|
);
|
|
56
57
|
})
|
|
@@ -88,9 +89,9 @@ export class CdpBrowserContext extends BrowserContext {
|
|
|
88
89
|
});
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
override async newPage(): Promise<Page> {
|
|
92
|
+
override async newPage(options?: CreatePageOptions): Promise<Page> {
|
|
92
93
|
using _guard = await this.waitForScreenshotOperations();
|
|
93
|
-
return await this.#browser._createPageInContext(this.#id);
|
|
94
|
+
return await this.#browser._createPageInContext(this.#id, options);
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
override browser(): CdpBrowser {
|
package/src/cdp/CdpSession.ts
CHANGED
|
@@ -27,7 +27,7 @@ import type {CdpTarget} from './Target.js';
|
|
|
27
27
|
export class CdpCDPSession extends CDPSession {
|
|
28
28
|
#sessionId: string;
|
|
29
29
|
#targetType: string;
|
|
30
|
-
#callbacks
|
|
30
|
+
#callbacks: CallbackRegistry;
|
|
31
31
|
#connection: Connection;
|
|
32
32
|
#parentSessionId?: string;
|
|
33
33
|
#target?: CdpTarget;
|
|
@@ -46,6 +46,7 @@ export class CdpCDPSession extends CDPSession {
|
|
|
46
46
|
super();
|
|
47
47
|
this.#connection = connection;
|
|
48
48
|
this.#targetType = targetType;
|
|
49
|
+
this.#callbacks = new CallbackRegistry(connection._idGenerator);
|
|
49
50
|
this.#sessionId = sessionId;
|
|
50
51
|
this.#parentSessionId = parentSessionId;
|
|
51
52
|
this.#rawErrors = rawErrors;
|
|
@@ -70,7 +71,7 @@ export class CdpCDPSession extends CDPSession {
|
|
|
70
71
|
return this.#target;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
override connection(): Connection
|
|
74
|
+
override connection(): Connection {
|
|
74
75
|
return this.#connection;
|
|
75
76
|
}
|
|
76
77
|
|
package/src/cdp/Connection.ts
CHANGED
|
@@ -19,6 +19,10 @@ import {debug} from '../common/Debug.js';
|
|
|
19
19
|
import {ConnectionClosedError, TargetCloseError} from '../common/Errors.js';
|
|
20
20
|
import {EventEmitter} from '../common/EventEmitter.js';
|
|
21
21
|
import {createProtocolErrorMessage} from '../util/ErrorLike.js';
|
|
22
|
+
import {
|
|
23
|
+
createIncrementalIdGenerator,
|
|
24
|
+
type GetIdFn,
|
|
25
|
+
} from '../util/incremental-id-generator.js';
|
|
22
26
|
|
|
23
27
|
import {CdpCDPSession} from './CdpSession.js';
|
|
24
28
|
|
|
@@ -38,6 +42,7 @@ export class Connection extends EventEmitter<CDPSessionEvents> {
|
|
|
38
42
|
#manuallyAttached = new Set<string>();
|
|
39
43
|
#callbacks: CallbackRegistry;
|
|
40
44
|
#rawErrors = false;
|
|
45
|
+
#idGenerator: GetIdFn;
|
|
41
46
|
|
|
42
47
|
constructor(
|
|
43
48
|
url: string,
|
|
@@ -45,10 +50,12 @@ export class Connection extends EventEmitter<CDPSessionEvents> {
|
|
|
45
50
|
delay = 0,
|
|
46
51
|
timeout?: number,
|
|
47
52
|
rawErrors = false,
|
|
53
|
+
idGenerator: () => number = createIncrementalIdGenerator(),
|
|
48
54
|
) {
|
|
49
55
|
super();
|
|
50
56
|
this.#rawErrors = rawErrors;
|
|
51
|
-
this.#
|
|
57
|
+
this.#idGenerator = idGenerator;
|
|
58
|
+
this.#callbacks = new CallbackRegistry(idGenerator);
|
|
52
59
|
this.#url = url;
|
|
53
60
|
this.#delay = delay;
|
|
54
61
|
this.#timeout = timeout ?? 180_000;
|
|
@@ -80,6 +87,13 @@ export class Connection extends EventEmitter<CDPSessionEvents> {
|
|
|
80
87
|
return this.#closed;
|
|
81
88
|
}
|
|
82
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*/
|
|
93
|
+
get _idGenerator(): GetIdFn {
|
|
94
|
+
return this.#idGenerator;
|
|
95
|
+
}
|
|
96
|
+
|
|
83
97
|
/**
|
|
84
98
|
* @internal
|
|
85
99
|
*/
|