GoogleChromeLabs / chromium-bidi

Implementation of WebDriver BiDi for Chromium
https://googlechromelabs.github.io/chromium-bidi/
Apache License 2.0
87 stars 30 forks source link

Feature: subscribing to specific CDP events does not work for user-facing CDP sessions #2422

Open OrKoN opened 1 month ago

OrKoN commented 1 month ago

Puppeteer allows creating custom CDP sessions via page.createCDPSession(). The user gets direct access to the raw session this way. Currently, bidi+ requires subscribing to individual cdp events or the entire CDP module (per browsing context), but the session ultimately gives access to sub-sessions which might not be browsing contexts at all. The ideal solution would be to forward all events on CDP sessions not owned by chromium-bidi implementation because the CDP session itself is responsible for enabling CDP domains and does not need a WebDriver event configuration.

cc @sadym-chromium @Lightning00Blade

OrKoN commented 1 month ago

To support this, we should listen for CDP events on the browserCdpClient and emit the bidi+ event for all external (unknown) session IDs on the mapper server's CDP connection.

Alternative design we might consider for Puppeteer is to stop using bidi+ for user-facing CDP sessions and instead create a second browser-level CDP connection for these use cases omitting the mapper. cc @Lightning00Blade