WebDriver BiDi for Python — talk to any browser via W3C standard
Project description
bidiwave
WebDriver BiDi for Python — talk to any browser via W3C standard.
Features
- W3C WebDriver BiDi — standard, not proprietary CDP
- Cross-browser — Chrome, Firefox, Edge (Safari when BiDi support lands)
- Async-first — native
async/awaitwithasyncio - 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
pip install bidiwave
Quick start
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
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
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
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
google-chrome --headless=new --remote-debugging-port=9222 --enable-bidi
Firefox
firefox --headless --remote-debugging-port=9223 --no-remote
Documentation
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bidiwave-1.7.0.tar.gz.
File metadata
- Download URL: bidiwave-1.7.0.tar.gz
- Upload date:
- Size: 81.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20b37c3f5a9fb6bdbbcdf75a584d6e8a4ccc873248cc6a05e5656f8892dae0fd
|
|
| MD5 |
3477fcc76a93a8afd30bf2e250432963
|
|
| BLAKE2b-256 |
729f575b9f4adda89b9417a1b75e158b9ab155195d1f849998709d6510c3d317
|
Provenance
The following attestation bundles were made for bidiwave-1.7.0.tar.gz:
Publisher:
release.yml on MathiasPaulenko/bidiwave
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bidiwave-1.7.0.tar.gz -
Subject digest:
20b37c3f5a9fb6bdbbcdf75a584d6e8a4ccc873248cc6a05e5656f8892dae0fd - Sigstore transparency entry: 2063193495
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/bidiwave@981bb6dfebc812e241d87903d39e6a08e55739c3 -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@981bb6dfebc812e241d87903d39e6a08e55739c3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file bidiwave-1.7.0-py3-none-any.whl.
File metadata
- Download URL: bidiwave-1.7.0-py3-none-any.whl
- Upload date:
- Size: 41.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
98f71151bdd22737c06e2a73a5fb1045862c94ac71deacc016f05d01515adf32
|
|
| MD5 |
89547b8556bff03a49c0e6b62a7c0820
|
|
| BLAKE2b-256 |
a782506247849299d36a2316ba757cab2dcbba0eea87e2816f108a811a694bfc
|
Provenance
The following attestation bundles were made for bidiwave-1.7.0-py3-none-any.whl:
Publisher:
release.yml on MathiasPaulenko/bidiwave
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bidiwave-1.7.0-py3-none-any.whl -
Subject digest:
98f71151bdd22737c06e2a73a5fb1045862c94ac71deacc016f05d01515adf32 - Sigstore transparency entry: 2063193576
- Sigstore integration time:
-
Permalink:
MathiasPaulenko/bidiwave@981bb6dfebc812e241d87903d39e6a08e55739c3 -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/MathiasPaulenko
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@981bb6dfebc812e241d87903d39e6a08e55739c3 -
Trigger Event:
push
-
Statement type: