Conversation
|
PR Description updated to latest commit (929f205)
|
PR Review 🔍
|
| """ | ||
| return self.execute(Command.GET_LOG, {"type": log_type})["value"] | ||
|
|
||
| def start_devtools(self): |
There was a problem hiding this comment.
I'm not sure about the naming here, any suggestions are welcome.
There was a problem hiding this comment.
Java calls this getDevTools(), I am not sure what is the idiomatic fit for Python.
There was a problem hiding this comment.
to start a devtools session in Java -> devTools.createSession();
There was a problem hiding this comment.
This method both gets DevTools (loads the proper version) and creates session, then returns both the loaded devtools module and the established connection. start_devtools is the best possible name I came up with for these 2 operations. We could of course split them into 2 separate methods...
There was a problem hiding this comment.
for bidi this should be an implementation detail in the higher level APIs, so not too concerned about it.
PR Code Suggestions ✨
|
| self._started = False | ||
| self._ws = None | ||
|
|
||
| def execute(self, command): |
There was a problem hiding this comment.
A general comment that applies to this whole PR - do we want to have typing properly implemented? I'm not familiar with the Python typing system so I did what was the easiest for me. I can re-iterate and add types if that's preferred.
There was a problem hiding this comment.
I would invest in typing for the BiDi implementation. Not much in the CDP one.
There was a problem hiding this comment.
Types are already available in CDP, the question is should I add types to the WebSocketConnection class.
There was a problem hiding this comment.
I don't think this should be the priority right now. Focus on getting the hard parts implemented, and we can get help from others on the typing later.
CI Failure Feedback 🧐(Checks updated until commit a4b8fa4)
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR: where Configuration options
See more information about the |
2958797 to
690e94f
Compare
|
@p0deje you can lint with |
User description
Initial implementation of #13975. This provides a low-level API that:
Once this is merged, I'll work on the subsequent PRs that provide high-level API backed by CDP for now (network interception, log events, basic authentication, etc).
The implementation can also be used to send BiDi commands and subscribe to events once BiDi is implemented in Python (assuming we follow the same pattern as for CDP).
PR Type
Enhancement, Tests
Description
start_devtoolsmethod inwebdriver.pyto establish a WebSocket connection and interact with DevTools.WebSocketConnectionclass to manage WebSocket connections, send and receive messages, and handle events.websocket-clientdependency torequirements.txt.event_classdecorator to addevent_classattribute to classes.Changes walkthrough 📝
generate.py
Add `event_class` attribute to event classes.py/generate.py
event_classattribute to classes decorated withevent_classdecorator.
webdriver.py
Add `start_devtools` method for WebSocket connection to DevTools.py/selenium/webdriver/remote/webdriver.py
WebSocketConnection.start_devtoolsmethod to establish WebSocket connection andinteract with DevTools.
_websocket_connectionattribute.websocket_connection.py
Implement `WebSocketConnection` class for WebSocket communication.py/selenium/webdriver/remote/websocket_connection.py
WebSocketConnectionclass to manage WebSocket connections.events, and managing connection state.
devtools_tests.py
Add tests for DevTools WebSocket connection and console logging.py/test/selenium/webdriver/common/devtools_tests.py
logging.
requirements.txt
Add `websocket-client` dependency.py/requirements.txt
websocket-clientdependency.