Repository navigation
Read attributes of a text match inside a line - #1065
Merged
Merged
Conversation
getByText on an inline span read in its parent's line resolved to a bare text node with no attributes, so GetAttributeAsync("id") returned null. The node now carries the element's attributes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 39 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
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.
Screen.GetByText("hello")on<div id=div1><span id=span1>hello</span>world</div>found the span but read no attributes from it, soGetAttributeAsync("id")returned null. A span read in its parent's line has no tree node of its own. The port answers a text query with a bare text node for it, and that node carried no attributes. It now carries the element's attributes, so the match readsid,classand the rest.Upstream (tester-army/e2e
bdf769b, testselectors-text) resolvesgetByTextthrough a Playwright locator on the real element, so it reads the span's attributes. The port resolves text over its tree, so this fix gives the same result.Test:
ControlsTests.A_text_match_inside_a_line_reads_its_own_attributesis .NET-only. It covers the inline text node, which upstream does not have. The portedselectors-texttest in #1064 still usesExpectedToFailAsyncfor this step. Remove it there once this merges..NET-only: the
attributesfield on the inline text nodes inPageScript.cs. It has no upstream counterpart because upstream has no such nodes.Closes #1062
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ls2e1yaZFgZ3FEJkYScfkK