-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
[py] BiDi Network implementation of Intercepts and Auth in Python #14592
base: trunk
Are you sure you want to change the base?
[py] BiDi Network implementation of Intercepts and Auth in Python #14592
Conversation
PR Reviewer Guide 🔍(Review updated until commit 2b3bb2a)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 2b3bb2a Explore these optional code suggestions:
Previous suggestions✅ Suggestions up to commit 01f6aaf
✅ Suggestions up to commit 14bf971
|
Thought I might need it, but didn't
was adding this to BUILD.bazel for easy testing:
so i could run |
Think it's ready now... @AutomatedTester could you give it a look? |
Persistent review updated to latest commit 01f6aaf |
I updated the callback_on_url() construction in add_request/response_handler() to create a unique request_id if not provided with one in data, but it might be better to throw an exception instead (or simply set it as None):
|
@shbenzer Do you not want to continue working on the PR? |
I accidentally deleted the branch when I was cleaning up my fork (didn't think it'd close the pr but it's been reopened now) - I'm still working on it. However I'd love if someone could pull and give it a look to see if they can figure out the current blockage. |
Persistent review updated to latest commit 2b3bb2a |
Adding this to Build.Bazel for easy testing:
|
@@ -36,6 +36,11 @@ | |||
LOGGER = logging.getLogger(__name__) | |||
|
|||
remote_commands = { | |||
Command.ADD_INTERCEPT: ("POST", "/session/$sessionId/network/intercept"), |
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.
Not sure we will need these
params["headers"] = self.headers | ||
if self.body is not None: | ||
params["body"] = self.body | ||
command = {"method": "network.continueRequest", "params": params} |
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.
For a future PR, we might want to have a utility method that builds the commands to make things easier to read
@AutomatedTester Thanks for the review, do you think you could provide any insight into why these tests are failing? The browser is hanging after adding an intercept it seems. |
params = {"phases": phases, "contexts": contexts} | ||
else: | ||
params = {"phases": phases, "contexts": contexts, "urlPatterns": url_patterns} | ||
command = {"method": "network.addIntercept", "params": params} |
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.
We should either use Command.ADD_INTERCEPT
here in the method since we are declaring it in command.py
(which is currently not utilized) or remove those commands from command.py
.
User description
Add implementations for BiDi Network's Auth and Interception to Python
Description
Added network.py: Network, Request, and Response classes w/ related methods
Added bidi_network_tests.py
Motivation and Context
Issue #13993
Types of changes
Checklist
PR Type
Enhancement, Tests
Description
Added BiDi Network support for request/response interception and authentication.
Implemented
Network
,Request
, andResponse
classes with related methods.Integrated new network commands into WebDriver's remote command structure.
Added comprehensive tests for BiDi Network features, including request/response handling and authentication.
Changes walkthrough 📝
network.py
Implement BiDi Network operations and data encapsulation
py/selenium/webdriver/common/bidi/network.py
Network
class for BiDi Network operations.handling.
Request
andResponse
classes for encapsulating networkdata.
command.py
Add network-related commands for BiDi support
py/selenium/webdriver/remote/command.py
remote_connection.py
Map BiDi network commands to HTTP endpoints
py/selenium/webdriver/remote/remote_connection.py
connection.
webdriver.py
Integrate BiDi Network into WebDriver
py/selenium/webdriver/remote/webdriver.py
Network
class into WebDriver.websocket_connection.py
Enhance callback handling for BiDi network events
py/selenium/webdriver/remote/websocket_connection.py
bidi_network_tests.py
Add tests for BiDi Network features
py/test/selenium/webdriver/common/bidi_network_tests.py