Repository navigation
fill_login: find inputs inside open shadow roots - #109
Open
drzewkoKamil wants to merge 1 commit into
Open
drzewkoKamil wants to merge 1 commit into
drzewkoKamil wants to merge 1 commit into
Conversation
Sites built from web components (Material Web, Lit) keep their inputs in open shadow roots, where document.querySelector(All) never looks, so fill_login answered "No login fields found" on a visible login form. Search open shadow roots in page order, order username/password by their index in that list (compareDocumentPosition is meaningless across shadow trees), read the deepest activeElement, and let visible() walk up through shadow hosts. CLICK_POINT finds its target the same way. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #108.
What and why
fill_logincould not fill logins on sites whose inputs are in open shadow roots (e.g. Material Webmd-outlined-text-field):every lookup used
document.querySelector(All), so the finder saw no inputs and answered "No login fields found".This adds a shadow-aware search (
deepAll, in page order) and uses it for finding, marking, focusing, clearing andchoosing the sign-in control; orders username/password by their index in that list instead of
compareDocumentPosition(meaningless across shadow trees); reads the deepest
activeElement; and letsvisible()walk up through shadow hosts.CLICK_POINTinbox-login-page.tsfinds its target the same way and hit-tests against the element's own root.How it was checked
New test in
server/login-fill.test.tswith a shadow-root form: fails before, passes after (34 tests pass).FakeLoginPagenow looks through shadow roots for the focused element.Ran the real page scripts in an isolated DevTools world on a live Material Web login page: before
username: false, password: false, aftertrue / true, and both fields take focus. Nothing was typed or submitted.pnpm typecheckclean; oxlint clean on the changed files.box-login-page.e2e.test.tsis skipped here (no Chromium), not run.pnpm typecheck,pnpm lintandpnpm testpass (login-fill suite; full suite not run)New behaviour has a test
No secrets, personal data or local paths in the diff or screenshots
🤖 Generated with Claude Code