Repository navigation
[docs] ADR: windows are objects, reached through driver.windows - #17681
AutomatedTester wants to merge 14 commits into
Conversation
7a177ac to
6b5f6f8
Compare
Add user contexts (BiDi isolation unit) to the handle object model rather than a separate record: isolated= shortcut for the common case, the create_user_context() factory for shared partitions, session-option inheritance, and internal/private isolation types. Rename the file to use the PR number (17681) instead of an ADR number.
… contextCreated Point cross-references at the PR-number filenames, add expect_popup to the return-type change note, and list browsingContext.contextCreated (which backs expect_page/expect_popup) in the appendix for consistency with 17671.
Add a Java handle snippet alongside the JS one, and a subsection (with a Java example) stating that log/network events are scoped by subscription, not by the user context: global vs contexts=[tab] vs userContexts=[uc] (latter covers future tabs). Back it with the §3.6 subscription-matching fact in the appendix.
Aligns the record with 17670 (no protocol module on the driver), the window-handle and user-context scoping of 17685 and 17776, and returns objects rather than bare id strings from the new API.
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can move or hide resolved findings to focus on what still needs action Previous reviewsReview updated until commit 3f6512d Results up to commit c7dd587
|
|
Code review by qodo was updated up to the latest commit f9da341 |
diemol
left a comment
There was a problem hiding this comment.
The decision makes sense to me. Window objects through driver.windows fit well with #17670 and the scoping in #17685/#17776.
One process note: the README asks for "about a page", and this is around 190 lines with 9 decisions. Bundling is fine per the scoping rules, but could anything be cut down or left to the bindings to make review easier?
Narrow navigation waits to a window's own verbs and point waits for other navigations to #17676 and user prompts to #17672. State that closing an isolated window closes its popups and that an inherited setting the browser cannot apply fails context creation. Add options per sub-choice, a deprecation timeline and the Java default method, and cut the binding table and most code samples.
|
Thanks @diemol. Everything is addressed in 67f7982. The record is down from about 190 lines to about 130: the binding table and most code samples are gone, and considered options are now one line per sub-choice. That's still more than a page, because the template's options-per-sub-choice section pulls the other way. If there's a decision you'd rather leave to the bindings, I'm happy to cut it. The one open item is the default handler scope, discussed in the thread on decision 9. Generated by Claude Code |
|
Code review by qodo was updated up to the latest commit 67f7982 |
|
Code review by qodo was updated up to the latest commit 27d7c1f |
Window event handlers follow 17776's passive-observer rule, not 17685 decision 7, since there is no request to fail. Describe 17685's default scope correctly: bound to the window current at registration, it does not follow switch_to and misses windows opened later.
|
Code review by qodo was updated up to the latest commit e3f9459 |
|
Code review by qodo was updated up to the latest commit 120929d |
diemol
left a comment
There was a problem hiding this comment.
Thanks, almost everything from my review is addressed, and I resolved those threads. The one thing left is the default handler scope in decision 9: we'd ship with two meanings of "no scope" (here and in #17685). I'm OK accepting this if a follow-up record to change #17685's default is filed and linked here. Is that the plan?
Page load strategy names for per-call waits, last-window close, every user context in the list, default user context cannot be removed, inherited settings without an override, downloads scope, Java default methods for every new overload, and a link to the record proposing to align 17685's unscoped default.
|
Code review by qodo was updated up to the latest commit 84e560a |
|
Code review by qodo was updated up to the latest commit 6b5dd14 |
|
@diemol Yes, that's the plan. I've filed it as #18279: an unscoped network handler applies to every window in the session, superseding only the default in 17685 decision 11. Decision 9 here links to it. All eight inline comments are addressed in 84e560a and 6b5dd14. Generated by Claude Code |
diemol
left a comment
There was a problem hiding this comment.
I am approving this as the two comments I added are simple and after addressing them, this ADR can be merged from my point of view.
|
Code review by qodo was updated up to the latest commit 960f84a |
|
/agentic_review |
|
Code review by qodo was updated up to the latest commit 3f6512d |
titusfortner
left a comment
There was a problem hiding this comment.
First, with #18299 and #18300 we don't need this to support the Python deprecation plan, so there is no urgency to approve this.
The parts Diego approved I agree with. This is essentially what Watir has always done, and (apart from activate) none of it needs BiDi:
- a window object that carries its handle
- opening a window without switching to it
- window management on the window object: close, activate and switch
I also agree with a windows domain for the window handle methods and for the handler management to come.
My objection is to the rest of 3 through 6, the page commands on the window. There is no feature that requires this, and the alternative I prefer is not discussed in the ADR: the driver stores the current window handle, and users must explicitly switch to the window they want to send commands to. I don't think this precludes bindings from deciding to implement language-specific wrappers with things like Python's Context Manager that switches to the window, takes actions and switches back.
Most of the rest of this ADR pulls in scope that doesn't need to be decided here: user contexts, when navigation returns, result objects, and the navigation and download handlers.
For the browsing context handlers themselves, I have minor issues with some of the specific syntax, but maybe we should decide those for all handlers instead of just this one. Regardless, I think we need to adjust the scope before I can make more detailed requests.
Requested by David · project thread
📄 The decision, its rationale, considered options, and consequences are in the record file
this PR adds; read it there. The sections below are proposal notes and review logistics.
🔗 Related
get/refresh/back/forwardreturns; waiting for navigations the caller did not start is left to [docs] decision: navigation is awaited with expect_navigation / wait_for_url / wait_for_load_state #17676.📝 Proposal notes
driver.browsing_contextmodule as a compatibility surface, which 17670 decision 3 now rules out, and depended on [docs] decision: BiDi events are awaited with expect_* context managers #17671 (expect_*). Both are gone. Earlier review comments about naming and keeping the driver small are reflected in the "Considered options" section.🗣 Discussion
Windowreads best, but Java already hasWebDriver.Window. IsWindowin its own package acceptable there, or should every binding use something likeBrowserWindow?stagefield, or one family per stage?Discussed at the TLC meetings below; see the minutes for the full discussion and attribution.
📌 Tracking
Tracking issue: (linked on acceptance)
Generated by Claude Code