Closed ioquatix closed 1 month ago
Thanks for the suggestion. An API like that we considered useful and already implemented it for WebDriver BiDi. It's called session.end
. Given that our focus is on the BiDi protocol which will completely replace WebDriver classic eventually, I don't think that we will get such an API added for it.
I don't think we should let "eventually completely replace" get in the way of useful functionality today. That being said, I'm probably not going to be the one implementing it.
Note that there is a number of APIs that we are going to implement for BiDi only. And this is most likely one of these.
Does session.end
actually implement a session reset? I feel like session.end
means the session may not be used again. But what I'm asking for is a state reset of the given session, so we don't need to create the session for subsequent tests.
Sorry, but perhaps you can help with further clarification:
6.1.3.2. The session.new Command The session.new command allows creating a new BiDi session. NOTE: A session created this way will not be accessible via HTTP.
Regarding the NOTE, does that also apply that sessions created via HTTP are not accessible via the BiDi interface?
Note that creating a new session with WebDriver BiDi is cheap. Note that it will not restart the browser as for WebDriver HTTP. So I don't see an issue here.
Regarding your last question, it is always possible to access a session as created via WebDriver HTTP from BiDi. But it's not possible the other way around.
Creating a new session can be slow. In my tests, it's between 300-500ms on Chrome, and about 2x that on Firefox.
Reusing sessions can significantly improve test throughput and latency by amortising the startup cost.
I'm currently investigating whether a session reset is good enough:
I think it would be pretty awesome if we had a session reset mechanism. Ideally it would return a new session ID (to invalidate any existing references) but reuse as much state as possible to reduce the overhead of creating a new session.