BiDi Network Monitoring in Python Selenium - Implementation Status Question

21 views
Skip to first unread message

Buffer Wish

unread,
Sep 11, 2025, 9:32:30 PMSep 11
to Selenium Users
Environment Details
  • Selenium Version: 4.35.0
  • Python Version: 3.12
  • Chrome Version: 139.0.7258.155
  • Platform: macOs
Question Summary

I'm trying to understand the current implementation status of BiDi network monitoring in Python Selenium. The API appears to exist but doesn't seem to function as expected.

What I've Discovered

These Work (API Surface Exists)
```
from selenium.webdriver.common.bidi.network import Network, NetworkEvent

# Import succeeds
network = Network(driver)

# Method exists and is callable
print(dir(Network))  # Shows add_request_handler, remove_request_handler, etc.

# Constants exist
print(Network.EVENTS['response_completed'])  # Returns 'network.responseCompleted'
```

This Fails (Actual Functionality)
```
def response_handler(event):
    print(f"Network event: {event}")

# This call fails with: "Event network.responseCompleted not found"
network.add_request_handler(
    Network.EVENTS['response_completed'],
    response_handler
)
```

Browser Setup
```
options = webdriver.ChromeOptions()
options.set_capability('webSocketUrl', True)
driver = webdriver.Chrome(service=service, options=options)

```

My Questions

  1. Is BiDi network monitoring actually functional in current Python Selenium?
  2. Should I expect add_request_handler() to work, or is this still under development?
  3. Is there a working example of BiDi network event capture in Python anywhere?
  4. What's the recommended approach for selective network monitoring (capturing specific API responses without getting all network traffic)?
Use Case Context
I'm trying to monitor specific API responses during automated browsing (e.g., search result APIs) without capturing every single network request - which is exactly what BiDi was designed to solve.

What I've Tried

  • Various event types from Network.EVENTS
  • Different browser configurations
  • Checked PR #14592 which marked Python addRequestHandler() as complete

    The disconnect between the API existing (importable, callable) and the functionality failing suggests either:
  • The implementation is incomplete despite the interface existing.
  • I'm missing a required setup step
  • There's a configuration issue I haven't identified

    Any guidances on the current state of BiDi network monitoring in Python Selenium would be greatly appreciated.

    Thank you for any insights into whether this is expected behavior or if I should continue troubleshooting my implementation.

Corey Goldberg

unread,
Sep 11, 2025, 10:05:35 PMSep 11
to seleniu...@googlegroups.com

> current implementation status of BiDi
> network monitoring in Python Selenium

The BiDi network functionality is very new and is not yet supported in all browsers. Some of the features were just introduced in Chrome 140 last week. Request handlers do currently work, but all events are not yet supported.

It's very much a work in progress as the BiDi spec finalizes, browsers implement the required functionality, and Selenium updates the bindings.

You can look at some of the internal tests for examples of how to use it:


If you have specific questions, you are better off joining the Slack channel than using this mailing list:


-Corey



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/selenium-users/da8bf41a-e9dd-46b3-b975-5cabb41d3a5fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages