Repository navigation
feat(sdk-python): add role and text locator builders - #3192
Open
supremeboxlogos wants to merge 7 commits into
Open
supremeboxlogos wants to merge 7 commits into
supremeboxlogos wants to merge 7 commits into
Conversation
🦋 Changeset detectedLatest commit: 5843ace The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Architecture diagram
sequenceDiagram
participant Py as Python SDK User
participant Page as Page
participant Loc as Locator
participant SL as semantic_locator.py
participant RPC as RPCClient
participant Browser as Browser Engine
Note over Py,Browser: Lazy Locator Building Flow
Py->>Page: get_by_role(role, name=..., exact=...)
Page->>SL: encode_step(role_step(...))
SL->>SL: Build GetByRoleOptions + QueryStep
SL-->>Page: Encoded selector string
Page->>Loc: new Locator(encoded selector)
Py->>Loc: get_by_text(text, exact=...)
Loc->>SL: _append(text_step(...))
SL->>SL: Decode parent selector into steps
alt Parent has nth index
SL->>SL: Append nth step to query
end
SL->>SL: Serialize semantic locator query
SL-->>Loc: New lazy Locator
Note over Py,Browser: Action Execution (e.g., click)
Py->>Loc: click(timeout=...)
Loc->>RPC: locator.click(page_id, selector, nth, options)
RPC->>Browser: Evaluate query in browser
Browser-->>RPC: Click result
RPC-->>Loc: LocatorClickResult
Loc-->>Py: Result
Note over Py,SL: Regex Pattern Handling
alt Pattern with IGNORECASE/MULTILINE/DOTALL
SL->>SL: Convert to JS flags (i/m/s)
else Unsupported flags (ASCII, VERBOSE, DEBUG)
SL-->>Py: Raise ValueError
end
Note over Py,Loc: Descendant Chaining
Py->>Loc: locator("span")
Loc->>SL: _append(selector_step("span"))
SL->>SL: Preserve parent steps + nth
SL-->>Loc: New chained lazy Locator
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This branch has not been deployed
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.
why
Add Python role/text builders in a focused language-specific review. Stacked on #3191; approximately 580 changed lines including documentation and tests.
what changed
test plan