-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py][bidi]: add response handlers and network data collectors #16438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
[py][bidi]: add response handlers and network data collectors #16438
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||||||
|
I think data collectors should be managed for the user with the handler registration, let's discuss more. |
|
It is low-level api, we should treat the spec as is. |
|
In general we'll want a high level network class accessible directly from the driver, and a network module implementation class, in a bidi namespace, likely(?) private API. I think my issue here is that this class includes implementation details that need to be one level deeper. Everything calling out to sockets or converting things to spec syntax should be one level lower. First we must agree on the high level API, then we can figure out how to split things. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @navin772
|
Looks like this is your test failure |
|
@navin772 this is great work. I'll review it more closely soon. I am planning on building functionality for capturing HAR files, and this will be a key piece to enable that. |
@shbenzer Yeah, that is flaky in the CI, locally works fine, I will check it Edit: Fixed it. In CI the order of returned responses varies as compared to local so we need to check in all of the responses. |
User description
🔗 Related Issues
Addresses remaining methods for response handlers for python - #13993
💥 What does this PR do?
add_response_handlerremove_response_handlerclear_response_handlerscontinue_responsemethod.add_data_collectorremove_data_collectorget_data🔧 Implementation Notes
Initially I started out implementing the data collector feature only, but during testing response handlers were required, thus this PR grew bigger.
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement, Tests
Description
Adds network response handlers (
add_response_handler,remove_response_handler,clear_response_handlers) for BiDi protocolImplements
continue_responsemethod for modifying intercepted responsesAdds network data collector support (
add_data_collector,remove_data_collector,get_data)Introduces
BytesValue,StringValue, andBase64Valueclasses for handling network data encodingAdds comprehensive test coverage for response handlers, data collectors, and their integration
Diagram Walkthrough
File Walkthrough
network.py
Add response handlers, data collectors, and encoding classespy/selenium/webdriver/common/bidi/network.py
BytesValue,StringValue, andBase64Valueclasses for network dataencoding
add_response_handler,remove_response_handler,clear_response_handlers)add_data_collector,remove_data_collector,get_data)Responseclass withcontinue_responsemethod for responseinterception
clear_request_handlersto properly clean up subscriptionsbidi_network_tests.py
Add comprehensive tests for response handlers and data collectorspy/test/selenium/webdriver/common/bidi_network_tests.py
continue_responsemethod