fix: UIA compare les noms d'app au lieu des titres complets
"Fichier" dans "*,Ceci est un test – Bloc-notes" était rejeté parce que le titre attendu était "test.txt – Bloc-notes". Maintenant la comparaison extrait le nom d'app (Bloc-notes) et accepte le match si c'est la même application. Résout : "Ajouter un nouvel onglet" bloqué quand un fichier différent est ouvert dans Bloc-notes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -302,15 +302,25 @@ class ActionExecutorV1:
|
||||
break
|
||||
|
||||
if found_root and expected_root != found_root:
|
||||
if (expected_root.lower() not in found_root.lower()
|
||||
and found_root.lower() not in expected_root.lower()):
|
||||
def _app_from(t):
|
||||
for s in [" – ", " - ", " — "]:
|
||||
if s in t:
|
||||
return t.split(s)[-1].strip().lower()
|
||||
return t.strip().lower()
|
||||
|
||||
same_app = _app_from(expected_root) == _app_from(found_root)
|
||||
substring_match = (
|
||||
expected_root.lower() in found_root.lower()
|
||||
or found_root.lower() in expected_root.lower()
|
||||
)
|
||||
if not same_app and not substring_match:
|
||||
logger.warning(
|
||||
f"UIA REJET : '{name}' trouvé dans '{found_root}' "
|
||||
f"mais attendu dans '{expected_root}'"
|
||||
)
|
||||
print(
|
||||
f" [UIA] REJET — '{name}' trouvé dans mauvaise fenêtre "
|
||||
f"({found_root} ≠ {expected_root})"
|
||||
f" [UIA] REJET — '{name}' dans mauvaise app "
|
||||
f"({_app_from(found_root)} ≠ {_app_from(expected_root)})"
|
||||
)
|
||||
return None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user