Skip to content

fix: pick locator uses correct role and full name for elements with children (#843)#844

Merged
stevez merged 1 commit into
mainfrom
fix/pick-locator-interactive-children
Apr 26, 2026
Merged

fix: pick locator uses correct role and full name for elements with children (#843)#844
stevez merged 1 commit into
mainfrom
fix/pick-locator-interactive-children

Conversation

@stevez

@stevez stevez commented Apr 26, 2026

Copy link
Copy Markdown
Owner

Summary

  • parseAriaSnapshot treated all multi-line snapshots as parent→child, but when the picked element has structural children (generic, img, text), it misidentified the child as the element
  • This caused wrong role in pw assertion (generic instead of link) and truncated name in pw command
  • Fix: only treat first line as parent when the first child has an interactive role (button, checkbox, link, etc.). Otherwise, the first line IS the picked element.

Before / After

Before:

pw:     highlight link "View bill for account number"          ← truncated, fails with exact match
assert: verify-element generic "View bill for account number"  ← wrong role

After:

pw:     highlight link "View bill for account number 877380717"  ← full name, works
assert: verify-element link "View bill for account number 877380717"  ← correct role

Test plan

  • 3 new tests: link with generic children, listitem with checkbox, button with generic children
  • All 61 pick-info tests pass
  • Manual test on Rogers MyRogers "View bill" link

Closes #843

🤖 Generated with Claude Code

…hildren (#843)

parseAriaSnapshot treated multi-line snapshots as parent→child, but when
the picked element itself has structural children (generic, img, text),
it misidentified the child as the element. This caused:

- pw assertion using child's role (generic) instead of element's role (link)
- pw command using truncated JS name instead of full aria accessible name

Fix: check if the first child has an interactive role (button, checkbox,
link, etc.). If not, the first line IS the element — children are just
DOM contents. Container→child parsing only applies when the child is
interactive (e.g. listitem → checkbox).

Closes #843

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@stevez
stevez merged commit d57b0db into main Apr 26, 2026
8 checks passed
@stevez
stevez deleted the fix/pick-locator-interactive-children branch April 26, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: pick locator pw output — wrong assert role and truncated name

1 participant