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
|
@@ -10,6 +10,7 @@ import type {ConnectionTransport} from '../common/ConnectionTransport.js';
|
|
|
10
10
|
import type {ConnectOptions} from '../common/ConnectOptions.js';
|
|
11
11
|
import {ProtocolError, UnsupportedOperation} from '../common/Errors.js';
|
|
12
12
|
import {debugError, DEFAULT_VIEWPORT} from '../common/util.js';
|
|
13
|
+
import {createIncrementalIdGenerator} from '../util/incremental-id-generator.js';
|
|
13
14
|
|
|
14
15
|
import type {BidiBrowser} from './Browser.js';
|
|
15
16
|
import type {BidiConnection} from './Connection.js';
|
|
@@ -66,12 +67,17 @@ async function getBiDiConnection(
|
|
|
66
67
|
closeCallback: BrowserCloseCallback;
|
|
67
68
|
}> {
|
|
68
69
|
const BiDi = await import(/* webpackIgnore: true */ './bidi.js');
|
|
69
|
-
const {
|
|
70
|
+
const {
|
|
71
|
+
slowMo = 0,
|
|
72
|
+
protocolTimeout,
|
|
73
|
+
idGenerator = createIncrementalIdGenerator(),
|
|
74
|
+
} = options;
|
|
70
75
|
|
|
71
76
|
// Try pure BiDi first.
|
|
72
77
|
const pureBidiConnection = new BiDi.BidiConnection(
|
|
73
78
|
url,
|
|
74
79
|
connectionTransport,
|
|
80
|
+
idGenerator,
|
|
75
81
|
slowMo,
|
|
76
82
|
protocolTimeout,
|
|
77
83
|
);
|
|
@@ -102,6 +108,7 @@ async function getBiDiConnection(
|
|
|
102
108
|
slowMo,
|
|
103
109
|
protocolTimeout,
|
|
104
110
|
/* rawErrors= */ true,
|
|
111
|
+
idGenerator,
|
|
105
112
|
);
|
|
106
113
|
|
|
107
114
|
const version = await cdpConnection.send('Browser.getVersion');
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Bidi from 'webdriver-bidi-protocol';
|
|
8
8
|
|
|
9
|
-
import type {Permission} from '../api/Browser.js';
|
|
9
|
+
import type {CreatePageOptions, Permission} from '../api/Browser.js';
|
|
10
10
|
import {WEB_PERMISSION_TO_PROTOCOL_PERMISSION} from '../api/Browser.js';
|
|
11
11
|
import type {BrowserContextEvents} from '../api/BrowserContext.js';
|
|
12
12
|
import {BrowserContext, BrowserContextEvent} from '../api/BrowserContext.js';
|
|
@@ -181,12 +181,15 @@ export class BidiBrowserContext extends BrowserContext {
|
|
|
181
181
|
});
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
override async newPage(): Promise<Page> {
|
|
184
|
+
override async newPage(options?: CreatePageOptions): Promise<Page> {
|
|
185
185
|
using _guard = await this.waitForScreenshotOperations();
|
|
186
186
|
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
187
|
+
const type =
|
|
188
|
+
options?.type === 'window'
|
|
189
|
+
? Bidi.BrowsingContext.CreateType.Window
|
|
190
|
+
: Bidi.BrowsingContext.CreateType.Tab;
|
|
191
|
+
|
|
192
|
+
const context = await this.userContext.createBrowsingContext(type);
|
|
190
193
|
const page = this.#pages.get(context)!;
|
|
191
194
|
if (!page) {
|
|
192
195
|
throw new Error('Page is not found');
|
|
@@ -221,7 +224,7 @@ export class BidiBrowserContext extends BrowserContext {
|
|
|
221
224
|
return this.#browser;
|
|
222
225
|
}
|
|
223
226
|
|
|
224
|
-
override async pages(): Promise<BidiPage[]> {
|
|
227
|
+
override async pages(_includeAll = false): Promise<BidiPage[]> {
|
|
225
228
|
return [...this.userContext.browsingContexts].map(context => {
|
|
226
229
|
return this.#pages.get(context)!;
|
|
227
230
|
});
|
package/src/bidi/Connection.ts
CHANGED
|
@@ -14,6 +14,7 @@ import {ConnectionClosedError} from '../common/Errors.js';
|
|
|
14
14
|
import type {EventsWithWildcard} from '../common/EventEmitter.js';
|
|
15
15
|
import {EventEmitter} from '../common/EventEmitter.js';
|
|
16
16
|
import {debugError} from '../common/util.js';
|
|
17
|
+
import type {GetIdFn} from '../util/incremental-id-generator.js';
|
|
17
18
|
|
|
18
19
|
import {BidiCdpSession} from './CDPSession.js';
|
|
19
20
|
import type {
|
|
@@ -57,12 +58,13 @@ export class BidiConnection
|
|
|
57
58
|
#delay: number;
|
|
58
59
|
#timeout = 0;
|
|
59
60
|
#closed = false;
|
|
60
|
-
#callbacks
|
|
61
|
+
#callbacks: CallbackRegistry;
|
|
61
62
|
#emitters: Array<EventEmitter<any>> = [];
|
|
62
63
|
|
|
63
64
|
constructor(
|
|
64
65
|
url: string,
|
|
65
66
|
transport: ConnectionTransport,
|
|
67
|
+
idGenerator: GetIdFn,
|
|
66
68
|
delay = 0,
|
|
67
69
|
timeout?: number,
|
|
68
70
|
) {
|
|
@@ -70,6 +72,7 @@ export class BidiConnection
|
|
|
70
72
|
this.#url = url;
|
|
71
73
|
this.#delay = delay;
|
|
72
74
|
this.#timeout = timeout ?? 180_000;
|
|
75
|
+
this.#callbacks = new CallbackRegistry(idGenerator);
|
|
73
76
|
|
|
74
77
|
this.#transport = transport;
|
|
75
78
|
this.#transport.onmessage = this.onMessage.bind(this);
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type * as Bidi from 'webdriver-bidi-protocol';
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
DeviceRequestPrompt,
|
|
11
|
+
type DeviceRequestPromptDevice,
|
|
12
|
+
} from '../api/DeviceRequestPrompt.js';
|
|
13
|
+
import {UnsupportedOperation} from '../common/Errors.js';
|
|
14
|
+
import {Deferred} from '../util/Deferred.js';
|
|
15
|
+
|
|
16
|
+
import type {Session} from './core/Session.js';
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export class BidiDeviceRequestPromptManager {
|
|
22
|
+
readonly #session: Session;
|
|
23
|
+
readonly #contextId: string;
|
|
24
|
+
#enabled = false;
|
|
25
|
+
|
|
26
|
+
constructor(contextId: string, session: Session) {
|
|
27
|
+
this.#session = session;
|
|
28
|
+
this.#contextId = contextId;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async #enableIfNeeded(): Promise<void> {
|
|
32
|
+
if (!this.#enabled) {
|
|
33
|
+
this.#enabled = true;
|
|
34
|
+
await this.#session.subscribe(
|
|
35
|
+
['bluetooth.requestDevicePromptUpdated'],
|
|
36
|
+
[this.#contextId],
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
async waitForDevicePrompt(
|
|
42
|
+
timeout: number,
|
|
43
|
+
signal: AbortSignal | undefined,
|
|
44
|
+
): Promise<DeviceRequestPrompt> {
|
|
45
|
+
const deferred = Deferred.create<DeviceRequestPrompt>({
|
|
46
|
+
message: `Waiting for \`DeviceRequestPrompt\` failed: ${timeout}ms exceeded`,
|
|
47
|
+
timeout,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const onRequestDevicePromptUpdated = (
|
|
51
|
+
params: Bidi.Bluetooth.RequestDevicePromptUpdatedParameters,
|
|
52
|
+
) => {
|
|
53
|
+
if (params.context === this.#contextId) {
|
|
54
|
+
deferred.resolve(
|
|
55
|
+
new BidiDeviceRequestPrompt(
|
|
56
|
+
this.#contextId,
|
|
57
|
+
params.prompt,
|
|
58
|
+
this.#session,
|
|
59
|
+
params.devices,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
this.#session.off(
|
|
63
|
+
'bluetooth.requestDevicePromptUpdated',
|
|
64
|
+
onRequestDevicePromptUpdated,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
this.#session.on(
|
|
69
|
+
'bluetooth.requestDevicePromptUpdated',
|
|
70
|
+
onRequestDevicePromptUpdated,
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
if (signal) {
|
|
74
|
+
signal.addEventListener(
|
|
75
|
+
'abort',
|
|
76
|
+
() => {
|
|
77
|
+
deferred.reject(signal.reason);
|
|
78
|
+
},
|
|
79
|
+
{once: true},
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
await this.#enableIfNeeded();
|
|
84
|
+
|
|
85
|
+
return await deferred.valueOrThrow();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
export class BidiDeviceRequestPrompt extends DeviceRequestPrompt {
|
|
93
|
+
readonly #session: Session;
|
|
94
|
+
#promptId: string;
|
|
95
|
+
#contextId: string;
|
|
96
|
+
|
|
97
|
+
constructor(
|
|
98
|
+
contextId: string,
|
|
99
|
+
promptId: string,
|
|
100
|
+
session: Session,
|
|
101
|
+
devices: Bidi.Bluetooth.RequestDeviceInfo[],
|
|
102
|
+
) {
|
|
103
|
+
super();
|
|
104
|
+
this.#session = session;
|
|
105
|
+
this.#promptId = promptId;
|
|
106
|
+
this.#contextId = contextId;
|
|
107
|
+
|
|
108
|
+
this.devices.push(
|
|
109
|
+
...devices.map(d => {
|
|
110
|
+
return {
|
|
111
|
+
id: d.id,
|
|
112
|
+
name: d.name ?? 'UNKNOWN',
|
|
113
|
+
};
|
|
114
|
+
}),
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async cancel(): Promise<void> {
|
|
119
|
+
await this.#session.send('bluetooth.handleRequestDevicePrompt', {
|
|
120
|
+
context: this.#contextId,
|
|
121
|
+
prompt: this.#promptId,
|
|
122
|
+
accept: false,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async select(device: DeviceRequestPromptDevice): Promise<void> {
|
|
127
|
+
await this.#session.send('bluetooth.handleRequestDevicePrompt', {
|
|
128
|
+
context: this.#contextId,
|
|
129
|
+
prompt: this.#promptId,
|
|
130
|
+
accept: true,
|
|
131
|
+
device: device.id,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
waitForDevice(): never {
|
|
136
|
+
throw new UnsupportedOperation();
|
|
137
|
+
}
|
|
138
|
+
}
|
package/src/bidi/Frame.ts
CHANGED
|
@@ -21,13 +21,14 @@ import {
|
|
|
21
21
|
switchMap,
|
|
22
22
|
} from '../../third_party/rxjs/rxjs.js';
|
|
23
23
|
import type {CDPSession} from '../api/CDPSession.js';
|
|
24
|
+
import type {DeviceRequestPrompt} from '../api/DeviceRequestPrompt.js';
|
|
24
25
|
import {
|
|
25
26
|
Frame,
|
|
26
27
|
throwIfDetached,
|
|
27
28
|
type GoToOptions,
|
|
28
29
|
type WaitForOptions,
|
|
29
30
|
} from '../api/Frame.js';
|
|
30
|
-
import {PageEvent} from '../api/Page.js';
|
|
31
|
+
import {PageEvent, type WaitTimeoutOptions} from '../api/Page.js';
|
|
31
32
|
import {Accessibility} from '../cdp/Accessibility.js';
|
|
32
33
|
import type {ConsoleMessageType} from '../common/ConsoleMessage.js';
|
|
33
34
|
import {
|
|
@@ -474,8 +475,11 @@ export class BidiFrame extends Frame {
|
|
|
474
475
|
);
|
|
475
476
|
}
|
|
476
477
|
|
|
477
|
-
override waitForDevicePrompt(
|
|
478
|
-
|
|
478
|
+
override waitForDevicePrompt(
|
|
479
|
+
options: WaitTimeoutOptions = {},
|
|
480
|
+
): Promise<DeviceRequestPrompt> {
|
|
481
|
+
const {timeout = this.timeoutSettings.timeout(), signal} = options;
|
|
482
|
+
return this.browsingContext.waitForDevicePrompt(timeout, signal);
|
|
479
483
|
}
|
|
480
484
|
|
|
481
485
|
override get detached(): boolean {
|
package/src/bidi/HTTPRequest.ts
CHANGED
|
@@ -109,17 +109,6 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|
|
109
109
|
this.#request.on('authenticate', this.#handleAuthentication);
|
|
110
110
|
|
|
111
111
|
this.#frame.page().trustedEmitter.emit(PageEvent.Request, this);
|
|
112
|
-
|
|
113
|
-
if (this.#hasInternalHeaderOverwrite) {
|
|
114
|
-
this.interception.handlers.push(async () => {
|
|
115
|
-
await this.continue(
|
|
116
|
-
{
|
|
117
|
-
headers: this.headers(),
|
|
118
|
-
},
|
|
119
|
-
0,
|
|
120
|
-
);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
112
|
}
|
|
124
113
|
|
|
125
114
|
protected canBeIntercepted(): boolean {
|
|
@@ -165,21 +154,6 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|
|
165
154
|
return await this.#request.fetchPostData();
|
|
166
155
|
}
|
|
167
156
|
|
|
168
|
-
get #hasInternalHeaderOverwrite(): boolean {
|
|
169
|
-
return Boolean(
|
|
170
|
-
Object.keys(this.#extraHTTPHeaders).length ||
|
|
171
|
-
Object.keys(this.#userAgentHeaders).length,
|
|
172
|
-
);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
get #extraHTTPHeaders(): Record<string, string> {
|
|
176
|
-
return this.#frame?.page()._extraHTTPHeaders ?? {};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
get #userAgentHeaders(): Record<string, string> {
|
|
180
|
-
return this.#frame?.page()._userAgentHeaders ?? {};
|
|
181
|
-
}
|
|
182
|
-
|
|
183
157
|
override headers(): Record<string, string> {
|
|
184
158
|
// Callers should not be allowed to mutate internal structure.
|
|
185
159
|
const headers: Record<string, string> = {};
|
|
@@ -188,8 +162,6 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|
|
188
162
|
}
|
|
189
163
|
return {
|
|
190
164
|
...headers,
|
|
191
|
-
...this.#extraHTTPHeaders,
|
|
192
|
-
...this.#userAgentHeaders,
|
|
193
165
|
};
|
|
194
166
|
}
|
|
195
167
|
|
|
@@ -223,19 +195,6 @@ export class BidiHTTPRequest extends HTTPRequest {
|
|
|
223
195
|
return this.#frame;
|
|
224
196
|
}
|
|
225
197
|
|
|
226
|
-
override async continue(
|
|
227
|
-
overrides?: ContinueRequestOverrides,
|
|
228
|
-
priority?: number | undefined,
|
|
229
|
-
): Promise<void> {
|
|
230
|
-
return await super.continue(
|
|
231
|
-
{
|
|
232
|
-
headers: this.#hasInternalHeaderOverwrite ? this.headers() : undefined,
|
|
233
|
-
...overrides,
|
|
234
|
-
},
|
|
235
|
-
priority,
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
198
|
override async _continue(
|
|
240
199
|
overrides: ContinueRequestOverrides = {},
|
|
241
200
|
): Promise<void> {
|
package/src/bidi/Page.ts
CHANGED
|
@@ -8,7 +8,10 @@ import type Protocol from 'devtools-protocol';
|
|
|
8
8
|
import * as Bidi from 'webdriver-bidi-protocol';
|
|
9
9
|
|
|
10
10
|
import {firstValueFrom, from, raceWith} from '../../third_party/rxjs/rxjs.js';
|
|
11
|
+
import type {BluetoothEmulation} from '../api/BluetoothEmulation.js';
|
|
12
|
+
import type {WindowId} from '../api/Browser.js';
|
|
11
13
|
import type {CDPSession} from '../api/CDPSession.js';
|
|
14
|
+
import type {DeviceRequestPrompt} from '../api/DeviceRequestPrompt.js';
|
|
12
15
|
import type {BoundingBox} from '../api/ElementHandle.js';
|
|
13
16
|
import type {WaitForOptions} from '../api/Frame.js';
|
|
14
17
|
import type {HTTPResponse} from '../api/HTTPResponse.js';
|
|
@@ -17,6 +20,7 @@ import type {
|
|
|
17
20
|
GeolocationOptions,
|
|
18
21
|
MediaFeature,
|
|
19
22
|
PageEvents,
|
|
23
|
+
ReloadOptions,
|
|
20
24
|
WaitTimeoutOptions,
|
|
21
25
|
} from '../api/Page.js';
|
|
22
26
|
import {
|
|
@@ -44,12 +48,7 @@ import {EventEmitter} from '../common/EventEmitter.js';
|
|
|
44
48
|
import {FileChooser} from '../common/FileChooser.js';
|
|
45
49
|
import type {PDFOptions} from '../common/PDFOptions.js';
|
|
46
50
|
import type {Awaitable} from '../common/types.js';
|
|
47
|
-
import {
|
|
48
|
-
evaluationString,
|
|
49
|
-
isString,
|
|
50
|
-
parsePDFOptions,
|
|
51
|
-
timeout,
|
|
52
|
-
} from '../common/util.js';
|
|
51
|
+
import {evaluationString, parsePDFOptions, timeout} from '../common/util.js';
|
|
53
52
|
import type {Viewport} from '../common/Viewport.js';
|
|
54
53
|
import {assert} from '../util/assert.js';
|
|
55
54
|
import {bubble} from '../util/decorators.js';
|
|
@@ -137,9 +136,7 @@ export class BidiPage extends Page {
|
|
|
137
136
|
/**
|
|
138
137
|
* @internal
|
|
139
138
|
*/
|
|
140
|
-
|
|
141
|
-
#userAgentInterception?: string;
|
|
142
|
-
#userAgentPreloadScript?: string;
|
|
139
|
+
#overrideNavigatorPropertiesPreloadScript?: string;
|
|
143
140
|
override async setUserAgent(
|
|
144
141
|
userAgentOrOptions:
|
|
145
142
|
| string
|
|
@@ -185,26 +182,9 @@ export class BidiPage extends Page {
|
|
|
185
182
|
const enable = userAgent !== '';
|
|
186
183
|
userAgent = userAgent ?? (await this.#browserContext.browser().userAgent());
|
|
187
184
|
|
|
188
|
-
this.
|
|
189
|
-
? {
|
|
190
|
-
'User-Agent': userAgent,
|
|
191
|
-
}
|
|
192
|
-
: {};
|
|
193
|
-
|
|
194
|
-
this.#userAgentInterception = await this.#toggleInterception(
|
|
195
|
-
[Bidi.Network.InterceptPhase.BeforeRequestSent],
|
|
196
|
-
this.#userAgentInterception,
|
|
197
|
-
enable,
|
|
198
|
-
);
|
|
185
|
+
await this.#frame.browsingContext.setUserAgent(enable ? userAgent : null);
|
|
199
186
|
|
|
200
|
-
const overrideNavigatorProperties = (
|
|
201
|
-
userAgent: string,
|
|
202
|
-
platform: string | undefined,
|
|
203
|
-
) => {
|
|
204
|
-
Object.defineProperty(navigator, 'userAgent', {
|
|
205
|
-
value: userAgent,
|
|
206
|
-
configurable: true,
|
|
207
|
-
});
|
|
187
|
+
const overrideNavigatorProperties = (platform: string | undefined) => {
|
|
208
188
|
if (platform) {
|
|
209
189
|
Object.defineProperty(navigator, 'platform', {
|
|
210
190
|
value: platform,
|
|
@@ -218,16 +198,15 @@ export class BidiPage extends Page {
|
|
|
218
198
|
frames.push(...frame.childFrames());
|
|
219
199
|
}
|
|
220
200
|
|
|
221
|
-
if (this.#
|
|
201
|
+
if (this.#overrideNavigatorPropertiesPreloadScript) {
|
|
222
202
|
await this.removeScriptToEvaluateOnNewDocument(
|
|
223
|
-
this.#
|
|
203
|
+
this.#overrideNavigatorPropertiesPreloadScript,
|
|
224
204
|
);
|
|
225
205
|
}
|
|
226
206
|
const [evaluateToken] = await Promise.all([
|
|
227
207
|
enable
|
|
228
208
|
? this.evaluateOnNewDocument(
|
|
229
209
|
overrideNavigatorProperties,
|
|
230
|
-
userAgent,
|
|
231
210
|
platform || undefined,
|
|
232
211
|
)
|
|
233
212
|
: undefined,
|
|
@@ -236,12 +215,11 @@ export class BidiPage extends Page {
|
|
|
236
215
|
...frames.map(frame => {
|
|
237
216
|
return frame.evaluate(
|
|
238
217
|
overrideNavigatorProperties,
|
|
239
|
-
userAgent,
|
|
240
218
|
platform || undefined,
|
|
241
219
|
);
|
|
242
220
|
}),
|
|
243
221
|
]);
|
|
244
|
-
this.#
|
|
222
|
+
this.#overrideNavigatorPropertiesPreloadScript = evaluateToken?.identifier;
|
|
245
223
|
}
|
|
246
224
|
|
|
247
225
|
override async setBypassCSP(enabled: boolean): Promise<void> {
|
|
@@ -278,11 +256,23 @@ export class BidiPage extends Page {
|
|
|
278
256
|
return this.#frame;
|
|
279
257
|
}
|
|
280
258
|
|
|
259
|
+
override async emulateFocusedPage(enabled: boolean): Promise<void> {
|
|
260
|
+
return await this.#cdpEmulationManager.emulateFocus(enabled);
|
|
261
|
+
}
|
|
262
|
+
|
|
281
263
|
override resize(_params: {
|
|
282
264
|
contentWidth: number;
|
|
283
265
|
contentHeight: number;
|
|
284
266
|
}): Promise<void> {
|
|
285
|
-
throw new
|
|
267
|
+
throw new UnsupportedOperation();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
override windowId(): Promise<WindowId> {
|
|
271
|
+
throw new UnsupportedOperation();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
override openDevTools(): Promise<Page> {
|
|
275
|
+
throw new UnsupportedOperation();
|
|
286
276
|
}
|
|
287
277
|
|
|
288
278
|
async focusedFrame(): Promise<BidiFrame> {
|
|
@@ -332,11 +322,13 @@ export class BidiPage extends Page {
|
|
|
332
322
|
}
|
|
333
323
|
|
|
334
324
|
override async reload(
|
|
335
|
-
options:
|
|
325
|
+
options: ReloadOptions = {},
|
|
336
326
|
): Promise<BidiHTTPResponse | null> {
|
|
337
327
|
const [response] = await Promise.all([
|
|
338
328
|
this.#frame.waitForNavigation(options),
|
|
339
|
-
this.#frame.browsingContext.reload(
|
|
329
|
+
this.#frame.browsingContext.reload({
|
|
330
|
+
ignoreCache: options.ignoreCache ? true : undefined,
|
|
331
|
+
}),
|
|
340
332
|
]).catch(
|
|
341
333
|
rewriteNavigationError(
|
|
342
334
|
this.url(),
|
|
@@ -429,18 +421,42 @@ export class BidiPage extends Page {
|
|
|
429
421
|
|
|
430
422
|
override async setViewport(viewport: Viewport | null): Promise<void> {
|
|
431
423
|
if (!this.browser().cdpSupported) {
|
|
432
|
-
|
|
433
|
-
viewport
|
|
434
|
-
|
|
424
|
+
const viewportSize =
|
|
425
|
+
viewport?.width && viewport?.height
|
|
426
|
+
? {
|
|
427
|
+
width: viewport.width,
|
|
428
|
+
height: viewport.height,
|
|
429
|
+
}
|
|
430
|
+
: null;
|
|
431
|
+
|
|
432
|
+
const devicePixelRatio = viewport?.deviceScaleFactor
|
|
433
|
+
? viewport.deviceScaleFactor
|
|
434
|
+
: null;
|
|
435
|
+
|
|
436
|
+
// If `viewport` is not set, remove screen orientation override.
|
|
437
|
+
const screenOrientation: Bidi.Emulation.ScreenOrientation | null =
|
|
438
|
+
viewport
|
|
439
|
+
? viewport.isLandscape
|
|
435
440
|
? {
|
|
436
|
-
|
|
437
|
-
|
|
441
|
+
natural: Bidi.Emulation.ScreenOrientationNatural.Landscape,
|
|
442
|
+
type: 'landscape-primary',
|
|
438
443
|
}
|
|
439
|
-
:
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
+
: {
|
|
445
|
+
natural: Bidi.Emulation.ScreenOrientationNatural.Portrait,
|
|
446
|
+
type: 'portrait-primary',
|
|
447
|
+
}
|
|
448
|
+
: null;
|
|
449
|
+
|
|
450
|
+
await Promise.all([
|
|
451
|
+
this.#frame.browsingContext.setViewport({
|
|
452
|
+
viewport: viewportSize,
|
|
453
|
+
devicePixelRatio,
|
|
454
|
+
}),
|
|
455
|
+
this.#frame.browsingContext.setScreenOrientationOverride(
|
|
456
|
+
screenOrientation,
|
|
457
|
+
),
|
|
458
|
+
]);
|
|
459
|
+
|
|
444
460
|
this.#viewport = viewport;
|
|
445
461
|
return;
|
|
446
462
|
}
|
|
@@ -713,10 +729,7 @@ export class BidiPage extends Page {
|
|
|
713
729
|
|
|
714
730
|
get isNetworkInterceptionEnabled(): boolean {
|
|
715
731
|
return (
|
|
716
|
-
Boolean(this.#requestInterception) ||
|
|
717
|
-
Boolean(this.#extraHeadersInterception) ||
|
|
718
|
-
Boolean(this.#authInterception) ||
|
|
719
|
-
Boolean(this.#userAgentInterception)
|
|
732
|
+
Boolean(this.#requestInterception) || Boolean(this.#authInterception)
|
|
720
733
|
);
|
|
721
734
|
}
|
|
722
735
|
|
|
@@ -732,26 +745,10 @@ export class BidiPage extends Page {
|
|
|
732
745
|
/**
|
|
733
746
|
* @internal
|
|
734
747
|
*/
|
|
735
|
-
_extraHTTPHeaders: Record<string, string> = {};
|
|
736
|
-
#extraHeadersInterception?: string;
|
|
737
748
|
override async setExtraHTTPHeaders(
|
|
738
749
|
headers: Record<string, string>,
|
|
739
750
|
): Promise<void> {
|
|
740
|
-
|
|
741
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
742
|
-
assert(
|
|
743
|
-
isString(value),
|
|
744
|
-
`Expected value of header "${key}" to be String, but "${typeof value}" is found.`,
|
|
745
|
-
);
|
|
746
|
-
extraHTTPHeaders[key.toLowerCase()] = value;
|
|
747
|
-
}
|
|
748
|
-
this._extraHTTPHeaders = extraHTTPHeaders;
|
|
749
|
-
|
|
750
|
-
this.#extraHeadersInterception = await this.#toggleInterception(
|
|
751
|
-
[Bidi.Network.InterceptPhase.BeforeRequestSent],
|
|
752
|
-
this.#extraHeadersInterception,
|
|
753
|
-
Boolean(Object.keys(this._extraHTTPHeaders).length),
|
|
754
|
-
);
|
|
751
|
+
await this.#frame.browsingContext.setExtraHTTPHeaders(headers);
|
|
755
752
|
}
|
|
756
753
|
|
|
757
754
|
/**
|
|
@@ -797,7 +794,7 @@ export class BidiPage extends Page {
|
|
|
797
794
|
|
|
798
795
|
override async setOfflineMode(enabled: boolean): Promise<void> {
|
|
799
796
|
if (!this.#browserContext.browser().cdpSupported) {
|
|
800
|
-
|
|
797
|
+
return await this.#frame.browsingContext.setOfflineMode(enabled);
|
|
801
798
|
}
|
|
802
799
|
|
|
803
800
|
if (!this.#emulatedNetworkConditions) {
|
|
@@ -816,8 +813,20 @@ export class BidiPage extends Page {
|
|
|
816
813
|
networkConditions: NetworkConditions | null,
|
|
817
814
|
): Promise<void> {
|
|
818
815
|
if (!this.#browserContext.browser().cdpSupported) {
|
|
819
|
-
|
|
816
|
+
if (
|
|
817
|
+
!networkConditions?.offline &&
|
|
818
|
+
((networkConditions?.upload ?? -1) >= 0 ||
|
|
819
|
+
(networkConditions?.download ?? -1) >= 0 ||
|
|
820
|
+
(networkConditions?.latency ?? 0) > 0)
|
|
821
|
+
) {
|
|
822
|
+
// WebDriver BiDi supports only offline mode.
|
|
823
|
+
throw new UnsupportedOperation();
|
|
824
|
+
}
|
|
825
|
+
return await this.#frame.browsingContext.setOfflineMode(
|
|
826
|
+
networkConditions?.offline ?? false,
|
|
827
|
+
);
|
|
820
828
|
}
|
|
829
|
+
|
|
821
830
|
if (!this.#emulatedNetworkConditions) {
|
|
822
831
|
this.#emulatedNetworkConditions = {
|
|
823
832
|
offline: networkConditions?.offline ?? false,
|
|
@@ -989,8 +998,14 @@ export class BidiPage extends Page {
|
|
|
989
998
|
}
|
|
990
999
|
}
|
|
991
1000
|
|
|
992
|
-
override waitForDevicePrompt(
|
|
993
|
-
|
|
1001
|
+
override async waitForDevicePrompt(
|
|
1002
|
+
options: WaitTimeoutOptions = {},
|
|
1003
|
+
): Promise<DeviceRequestPrompt> {
|
|
1004
|
+
return await this.mainFrame().waitForDevicePrompt(options);
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
override get bluetooth(): BluetoothEmulation {
|
|
1008
|
+
return this.mainFrame().browsingContext.bluetooth;
|
|
994
1009
|
}
|
|
995
1010
|
}
|
|
996
1011
|
|