brave-real-puppeteer-core 24.25.0 → 24.33.0-patch.1
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 +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 +4 -4
- package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
- package/lib/cjs/puppeteer/api/HTTPRequest.d.ts +1 -1
- package/lib/cjs/puppeteer/api/Page.d.ts +41 -7
- 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 +36 -14
- 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 +19 -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 +2 -29
- 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/core/Request.d.ts +1 -0
- package/lib/cjs/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/lib/cjs/puppeteer/bidi/core/Request.js +30 -4
- package/lib/cjs/puppeteer/bidi/core/Request.js.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 +10 -0
- package/lib/cjs/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/Accessibility.js +30 -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/ExecutionContext.d.ts.map +1 -1
- package/lib/cjs/puppeteer/cdp/ExecutionContext.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 +6 -2
- package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPResponse.js +1 -1
- package/lib/cjs/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/lib/cjs/puppeteer/cdp/JSHandle.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 +30 -7
- 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/cdp/utils.d.ts +2 -2
- package/lib/cjs/puppeteer/cdp/utils.d.ts.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/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 +304 -22
- package/lib/es5-iife/puppeteer-core-browser.js +484 -224
- 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 +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 +4 -4
- package/lib/esm/puppeteer/api/Frame.js.map +1 -1
- package/lib/esm/puppeteer/api/HTTPRequest.d.ts +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 +41 -7
- 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 +36 -14
- 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 +19 -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 +2 -29
- 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/core/Request.d.ts +1 -0
- package/lib/esm/puppeteer/bidi/core/Request.d.ts.map +1 -1
- package/lib/esm/puppeteer/bidi/core/Request.js +31 -5
- package/lib/esm/puppeteer/bidi/core/Request.js.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 +10 -0
- package/lib/esm/puppeteer/cdp/Accessibility.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/Accessibility.js +30 -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/ExecutionContext.d.ts.map +1 -1
- package/lib/esm/puppeteer/cdp/ExecutionContext.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 +6 -2
- package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/lib/esm/puppeteer/cdp/HTTPResponse.js +1 -1
- package/lib/esm/puppeteer/cdp/HTTPResponse.js.map +1 -1
- package/lib/esm/puppeteer/cdp/JSHandle.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 +30 -7
- 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/cdp/utils.d.ts +2 -2
- package/lib/esm/puppeteer/cdp/utils.d.ts.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/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 +304 -22
- 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 +3 -5
- package/src/api/Frame.ts +7 -9
- package/src/api/HTTPRequest.ts +1 -1
- package/src/api/Page.ts +48 -11
- 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 +52 -14
- package/src/bidi/BrowserConnector.ts +8 -1
- package/src/bidi/BrowserContext.ts +9 -6
- package/src/bidi/Connection.ts +20 -1
- package/src/bidi/DeviceRequestPrompt.ts +138 -0
- package/src/bidi/Frame.ts +7 -3
- package/src/bidi/HTTPRequest.ts +2 -45
- 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/core/Request.ts +35 -5
- package/src/bidi/util.ts +8 -0
- package/src/cdp/Accessibility.ts +45 -4
- 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/ExecutionContext.ts +6 -2
- 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 +7 -2
- package/src/cdp/HTTPResponse.ts +1 -1
- package/src/cdp/JSHandle.ts +1 -1
- package/src/cdp/NetworkEventManager.ts +16 -1
- package/src/cdp/NetworkManager.ts +31 -1
- package/src/cdp/Page.ts +49 -14
- package/src/cdp/TargetManager.ts +36 -43
- package/src/cdp/WebWorker.ts +8 -3
- package/src/cdp/cdp.ts +1 -0
- package/src/cdp/utils.ts +2 -2
- 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
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
|
|
|
@@ -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/core/Request.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Bidi from 'webdriver-bidi-protocol';
|
|
8
8
|
|
|
9
|
-
import {ProtocolError} from '../../common/Errors.js';
|
|
9
|
+
import {ProtocolError, UnsupportedOperation} from '../../common/Errors.js';
|
|
10
10
|
import {EventEmitter} from '../../common/EventEmitter.js';
|
|
11
11
|
import {inertIfDisposed} from '../../util/decorators.js';
|
|
12
12
|
import {DisposableStack, disposeSymbol} from '../../util/disposable.js';
|
|
@@ -37,6 +37,7 @@ export class Request extends EventEmitter<{
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
#responseContentPromise: Promise<Uint8Array<ArrayBufferLike>> | null = null;
|
|
40
|
+
#requestBodyPromise: Promise<string> | null = null;
|
|
40
41
|
#error?: string;
|
|
41
42
|
#redirect?: Request;
|
|
42
43
|
#response?: Bidi.Network.ResponseData;
|
|
@@ -153,7 +154,14 @@ export class Request extends EventEmitter<{
|
|
|
153
154
|
return this.#event.request.request;
|
|
154
155
|
}
|
|
155
156
|
get initiator(): Bidi.Network.Initiator | undefined {
|
|
156
|
-
return
|
|
157
|
+
return {
|
|
158
|
+
...this.#event.initiator,
|
|
159
|
+
// Initiator URL is not specified in BiDi.
|
|
160
|
+
// @ts-expect-error non-standard property.
|
|
161
|
+
url: this.#event.request['goog:resourceInitiator']?.url,
|
|
162
|
+
// @ts-expect-error non-standard property.
|
|
163
|
+
stack: this.#event.request['goog:resourceInitiator']?.stack,
|
|
164
|
+
};
|
|
157
165
|
}
|
|
158
166
|
get method(): string {
|
|
159
167
|
return this.#event.request.method;
|
|
@@ -195,8 +203,7 @@ export class Request extends EventEmitter<{
|
|
|
195
203
|
}
|
|
196
204
|
|
|
197
205
|
get hasPostData(): boolean {
|
|
198
|
-
|
|
199
|
-
return this.#event.request['goog:hasPostData'] ?? false;
|
|
206
|
+
return (this.#event.request.bodySize ?? 0) > 0;
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
async continueRequest({
|
|
@@ -237,6 +244,29 @@ export class Request extends EventEmitter<{
|
|
|
237
244
|
});
|
|
238
245
|
}
|
|
239
246
|
|
|
247
|
+
async fetchPostData(): Promise<string | undefined> {
|
|
248
|
+
if (!this.hasPostData) {
|
|
249
|
+
return undefined;
|
|
250
|
+
}
|
|
251
|
+
if (!this.#requestBodyPromise) {
|
|
252
|
+
this.#requestBodyPromise = (async () => {
|
|
253
|
+
const data = await this.#session.send('network.getData', {
|
|
254
|
+
dataType: Bidi.Network.DataType.Request,
|
|
255
|
+
request: this.id,
|
|
256
|
+
});
|
|
257
|
+
if (data.result.bytes.type === 'string') {
|
|
258
|
+
return data.result.bytes.value;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// TODO: support base64 response.
|
|
262
|
+
throw new UnsupportedOperation(
|
|
263
|
+
`Collected request body data of type ${data.result.bytes.type} is not supported`,
|
|
264
|
+
);
|
|
265
|
+
})();
|
|
266
|
+
}
|
|
267
|
+
return await this.#requestBodyPromise;
|
|
268
|
+
}
|
|
269
|
+
|
|
240
270
|
async getResponseContent(): Promise<Uint8Array> {
|
|
241
271
|
if (!this.#responseContentPromise) {
|
|
242
272
|
this.#responseContentPromise = (async () => {
|
|
@@ -258,7 +288,7 @@ export class Request extends EventEmitter<{
|
|
|
258
288
|
)
|
|
259
289
|
) {
|
|
260
290
|
throw new ProtocolError(
|
|
261
|
-
'Could not load body for this request. This might happen if the request is a preflight request.',
|
|
291
|
+
'Could not load response body for this request. This might happen if the request is a preflight request.',
|
|
262
292
|
);
|
|
263
293
|
}
|
|
264
294
|
|
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.
|
|
@@ -76,11 +77,23 @@ export interface SerializedAXNode {
|
|
|
76
77
|
*/
|
|
77
78
|
invalid?: string;
|
|
78
79
|
orientation?: string;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Url for link elements.
|
|
83
|
+
*/
|
|
84
|
+
url?: string;
|
|
79
85
|
/**
|
|
80
86
|
* Children of this node, if there are any.
|
|
81
87
|
*/
|
|
82
88
|
children?: SerializedAXNode[];
|
|
83
89
|
|
|
90
|
+
/**
|
|
91
|
+
* CDP-specifc ID to reference the DOM node.
|
|
92
|
+
*
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
backendNodeId?: number;
|
|
96
|
+
|
|
84
97
|
/**
|
|
85
98
|
* Get an ElementHandle for this AXNode if available.
|
|
86
99
|
*
|
|
@@ -226,8 +239,13 @@ export class Accessibility {
|
|
|
226
239
|
if (!frame) {
|
|
227
240
|
return;
|
|
228
241
|
}
|
|
229
|
-
|
|
230
|
-
|
|
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
|
+
}
|
|
231
249
|
}
|
|
232
250
|
for (const child of root.children) {
|
|
233
251
|
await populateIframes(child);
|
|
@@ -460,12 +478,32 @@ class AXNode {
|
|
|
460
478
|
}
|
|
461
479
|
}
|
|
462
480
|
|
|
481
|
+
public isLandmark(): boolean {
|
|
482
|
+
switch (this.#role) {
|
|
483
|
+
case 'banner':
|
|
484
|
+
case 'complementary':
|
|
485
|
+
case 'contentinfo':
|
|
486
|
+
case 'form':
|
|
487
|
+
case 'main':
|
|
488
|
+
case 'navigation':
|
|
489
|
+
case 'region':
|
|
490
|
+
case 'search':
|
|
491
|
+
return true;
|
|
492
|
+
default:
|
|
493
|
+
return false;
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
463
497
|
public isInteresting(insideControl: boolean): boolean {
|
|
464
498
|
const role = this.#role;
|
|
465
499
|
if (role === 'Ignored' || this.#hidden || this.#ignored) {
|
|
466
500
|
return false;
|
|
467
501
|
}
|
|
468
502
|
|
|
503
|
+
if (this.isLandmark()) {
|
|
504
|
+
return true;
|
|
505
|
+
}
|
|
506
|
+
|
|
469
507
|
if (this.#focusable || this.#richlyEditable) {
|
|
470
508
|
return true;
|
|
471
509
|
}
|
|
@@ -514,6 +552,7 @@ class AXNode {
|
|
|
514
552
|
return node.nodeType === Node.TEXT_NODE ? node.parentElement : node;
|
|
515
553
|
})) as ElementHandle<Element>;
|
|
516
554
|
},
|
|
555
|
+
backendNodeId: this.payload.backendDOMNodeId,
|
|
517
556
|
};
|
|
518
557
|
|
|
519
558
|
type UserStringProperty =
|
|
@@ -522,7 +561,8 @@ class AXNode {
|
|
|
522
561
|
| 'description'
|
|
523
562
|
| 'keyshortcuts'
|
|
524
563
|
| 'roledescription'
|
|
525
|
-
| 'valuetext'
|
|
564
|
+
| 'valuetext'
|
|
565
|
+
| 'url';
|
|
526
566
|
|
|
527
567
|
const userStringProperties: UserStringProperty[] = [
|
|
528
568
|
'name',
|
|
@@ -531,6 +571,7 @@ class AXNode {
|
|
|
531
571
|
'keyshortcuts',
|
|
532
572
|
'roledescription',
|
|
533
573
|
'valuetext',
|
|
574
|
+
'url',
|
|
534
575
|
];
|
|
535
576
|
const getUserStringPropertyValue = (key: UserStringProperty): string => {
|
|
536
577
|
return properties.get(key) as string;
|
|
@@ -577,7 +618,7 @@ class AXNode {
|
|
|
577
618
|
continue;
|
|
578
619
|
}
|
|
579
620
|
const value = getBooleanPropertyValue(booleanProperty);
|
|
580
|
-
if (
|
|
621
|
+
if (value === undefined) {
|
|
581
622
|
continue;
|
|
582
623
|
}
|
|
583
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
|
+
}
|