Improve PageAction selector robustness by prioritizing test-id attributes#280
Open
Improve PageAction selector robustness by prioritizing test-id attributes#280
Conversation
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Improve PageAction recording logic for better robustness
Improve PageAction selector robustness by prioritizing test-id attributes
Feb 8, 2026
ujiro99
reviewed
Feb 8, 2026
There was a problem hiding this comment.
Pull request overview
This PR improves the robustness of generated RobulaPlus XPath selectors for PageAction recording by prioritizing language-agnostic data-test* attributes and excluding locale-dependent aria-label.
Changes:
- Added a
data-test*-first transformation (transfAddDataTestId) and reordered the transformation pipeline to prefer stable attributes early. - Blacklisted
aria-labelso it won’t be used in generated selectors. - Introduced XPath value escaping and added Vitest coverage for data-test* prioritization and aria-label exclusion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/extension/src/lib/robula-plus/index.ts | Adds data-test* prioritization + pipeline reorder, blacklists aria-label, and introduces XPath escaping helper. |
| packages/extension/src/lib/robula-plus/index.test.ts | Adds unit tests validating data-test* prioritization and aria-label exclusion behavior. |
Comments suppressed due to low confidence (1)
packages/extension/src/lib/robula-plus/index.ts:27
- Because
data-test*attributes are now handled explicitly intransfAddDataTestId, also adding them toattributePriorizationListmeanstransfAddAttributecan generate the same[@data-testid='...']predicate again (for values that passisAttributeUsable). Sincetemp = [...new Set(temp)]de-dupes by object identity (not XPath string), this can inflate the search space. Consider either (1) skippingDATA_TESTID_ATTRIBUTESinsidetransfAddAttribute, or (2) de-duping generated XPaths byx.getValue().
private attributePriorizationList: string[] = [
...RobulaPlus.DATA_TESTID_ATTRIBUTES,
"name",
"class",
"title",
"alt",
]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
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.
PageAction記録ロジックの改善
修正内容
1. XPathエスケープ処理の修正
'を使用するアプローチからXPath 1.0標準の方法に変更concat()関数を使用2. DATA_TESTID_ATTRIBUTES を public static に変更
3. テストの追加
テスト結果
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.