https://github.com/mathiaspaulenko/bidiwave
Python library for WebDriver BiDi communication with any browser. Async-first, cross-browser, no Selenium, no CDP.
https://github.com/mathiaspaulenko/bidiwave
asyncio automation bidi browser browser-automation cdp chrome firefox python selenium testing w3c webautomation webdriver webdriver-bidi
Last synced: 1 day ago
JSON representation
Python library for WebDriver BiDi communication with any browser. Async-first, cross-browser, no Selenium, no CDP.
- Host: GitHub
- URL: https://github.com/mathiaspaulenko/bidiwave
- Owner: MathiasPaulenko
- Created: 2026-07-03T02:03:59.000Z (2 days ago)
- Default Branch: main
- Last Pushed: 2026-07-03T16:47:17.000Z (1 day ago)
- Last Synced: 2026-07-03T17:00:14.709Z (1 day ago)
- Topics: asyncio, automation, bidi, browser, browser-automation, cdp, chrome, firefox, python, selenium, testing, w3c, webautomation, webdriver, webdriver-bidi
- Language: Python
- Size: 813 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# bidiwave
WebDriver BiDi for Python — talk to any browser via W3C standard.
[](https://github.com/MathiasPaulenko/bidiwave/actions/workflows/test.yml)
[](https://pypi.org/project/bidiwave/)
[](https://pypi.org/project/bidiwave/)
[](LICENSE)
## Features
- **W3C WebDriver BiDi** — standard, not proprietary CDP
- **Cross-browser** — Chrome, Firefox, Edge (Safari when BiDi support lands)
- **Async-first** — native `async/await` with `asyncio`
- **Event streaming** — console logs, navigation, network, contexts in real time
- **Input simulation** — clicks, keyboard, scroll, drag & drop via `input.performActions`
- **Network interception** — block, modify and mock HTTP requests
- **Type-safe** — Pydantic v2 models, type narrowing with `match`
- **Lightweight** — no Selenium, no Playwright required
## Install
```bash
pip install bidiwave
```
## Quick start
```python
import asyncio
from bidiwave import BiDiClient, StringValue
async def main():
async with await BiDiClient.connect("ws://localhost:9222/session") as client:
await client.session.new()
async with await client.browsing.open("https://example.com") as page:
# Evaluate JS
result = await page.evaluate("document.title")
match result:
case StringValue(value=title):
print(f"Title: {title}")
# Screenshot
screenshot = await page.screenshot()
with open("screenshot.png", "wb") as f:
f.write(screenshot)
asyncio.run(main())
```
## Console log monitoring
```python
async with await BiDiClient.connect(url) as client:
async def on_log(entry):
print(f"[{entry.level}] {entry.text}")
client.on("log.entryAdded", on_log)
await client.session.subscribe(["log.entryAdded"])
async with await client.browsing.open("https://example.com") as page:
await page.evaluate("console.log('hello!')")
await asyncio.sleep(2)
```
## Input simulation
```python
async with await BiDiClient.connect(url) as client:
async with await client.browsing.open("https://example.com") as page:
ctx = page.context
# Click at coordinates
await client.input.click(ctx, x=100, y=200)
# Type text
await client.input.type_text(ctx, "Hello, world!")
# Press Enter
await client.input.press_key(ctx, "Enter")
# Scroll down 500px
await client.input.scroll(ctx, delta_y=500)
# Drag and drop
await client.input.drag_and_drop(ctx, 100, 100, 300, 300)
```
## Network interception
```python
async with await BiDiClient.connect(url) as client:
# Block all requests to ads
intercept = await client.network.add_intercept(
phases=["beforeRequestSent"],
url_patterns=["*ads.example.com*"],
)
async with await client.browsing.open("https://example.com") as page:
await asyncio.sleep(2)
await client.network.remove_intercept(intercept.intercept_id)
```
## Launch a browser with BiDi
### Chrome
```bash
google-chrome --headless=new --remote-debugging-port=9222 --enable-bidi
```
### Firefox
```bash
firefox --headless --remote-debugging-port=9223 --no-remote
```
## Documentation
- [Quick Start](https://bidiwave.readthedocs.io/quick-start/)
- [API Reference](https://bidiwave.readthedocs.io/api/)
- [Network](https://bidiwave.readthedocs.io/api/network/)
- [Input](https://bidiwave.readthedocs.io/api/input/)
- [Cookbook](https://bidiwave.readthedocs.io/cookbook/)
- [Error Handling](https://bidiwave.readthedocs.io/error-handling/)
## License
MIT