selenium
selenium copied to clipboard
[🚀 Feature]: Synchronous DevTools/BiDi in Python
Feature and motivation
Implement DevTools/BiDI in Python bindings that don't require using the async/await pattern. The proof-of-concept is implemented in https://github.com/SeleniumHQ/selenium/commit/83112e1e7a521e63ec1bc8782e140ecd2e81bec8.
Usage example
For now, provide lower-level API that can use DevTools/CDP directly. The high-level API will be added later on top of this.
from selenium.webdriver.common.bidi import cdp
devtools = cdp.import_devtools(version)
# execute commands
driver.bidi().execute(devtools.runtime.enable())
# subscribe to events
console_api_calls = []
driver.bidi().on(devtools.runtime.ConsoleAPICalled, lambda e: console_api_calls.append(e))