mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-03 03:27:10 +00:00
fix(runner): an ambiguous name loses to the coordinates it was built from
Attribute values match by substring, so a selector that named one element where the candidate was built can name several in the tree it resolves against, and the lookup sent every one of them to the first match. The host gates blank an ambiguous tag at enumeration time; this closes the gap between that moment and the action. A bare-string target carries no coordinates, so the first match stays the answer there rather than dropping an authored action. Claude-Session: https://claude.ai/code/session_01A5KmftdEJ49A9z5mF5ESrX
This commit is contained in:
1 parent
fd7bf17256
commit
bf2da973de
2 files changed
+56
-2
No files matched your search
@@ -903,8 +903,15 @@ func resolveCoordinates(action verifier.Action, tree *hierarchy.Tree) (int, int,
|
||||
return 0, 0, false
|
||||
}
|
||||
if tree != nil {
|
||||
if element := tree.Find(action.On); element != nil {
|
||||
x, y := element.Bounds.Center()
|
||||
// An ambiguous selector names several elements while the action's own
|
||||
// coordinates name one, so the coordinates win. Attribute values match
|
||||
// by substring, so a selector unique where the candidate was built can
|
||||
// be ambiguous in the tree it resolves against. A bare-string target
|
||||
// carries no coordinates, and there the name is all there is.
|
||||
matches := tree.FindAll(action.On)
|
||||
hasCoordinates := action.X > 0 && action.Y > 0
|
||||
if len(matches) > 0 && (len(matches) == 1 || !hasCoordinates) {
|
||||
x, y := matches[0].Bounds.Center()
|
||||
if x > 0 && y > 0 {
|
||||
return x, y, true
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user