findElement: match accessible names by regex

`name` is a substring, which cannot say "starts with", "exactly this"
or "either of these". A name written as `/.../`, the spelling adblock
lists already use, is a JavaScript-syntax pattern compiled through the
App's PCRE2 context; an invalid one comes back as a tool error carrying
PCRE2's message and offset so the model can fix it rather than retry
blind.
This commit is contained in:
Adrià Arrufat committed 2026-09-15 09:33:39 +02:00
1 parent d2f72a9fa9
commit 158de60d64
4 files changed
+82 -8

No files matched your search

+2 -1
View File
@@ -203,7 +203,8 @@ fn note(tool: browser_tools.Tool) []const u8 {
.screenshot => "`path` is required: writes a PNG of the text layout.",
.press => "Selector first! `page.press(\"Enter\")` binds \"Enter\" to `selector` and fails — use `page.press(null, \"Enter\")` or `page.press({ key: \"Enter\" })`.",
.click, .fill, .scroll, .hover, .selectOption, .setChecked => "",
.search, .markdown, .html, .links, .tree, .nodeDetails, .interactiveElements, .structuredData, .detectForms, .findElement, .consoleLogs, .getUrl, .getCookies, .getEnv => "",
.findElement => "`name` is a case-insensitive substring, or a JS-syntax regex written as `/.../`.",
.search, .markdown, .html, .links, .tree, .nodeDetails, .interactiveElements, .structuredData, .detectForms, .consoleLogs, .getUrl, .getCookies, .getEnv => "",
};
}