feat: add cursor-interactive element detection in snapshots (#374)

* fix: only warn about ignored flags when explicitly passed via CLI

The warning about launch-time options being ignored (when daemon is
already running) was incorrectly shown when options were set via
environment variables like AGENT_BROWSER_EXECUTABLE_PATH, even when
no CLI flag was passed.

Now the warning only appears when flags are explicitly passed on the
command line, not when values come solely from environment variables.

Fixes #372

* feat: add cursor-interactive element detection in snapshots

Add -C/--cursor flag to snapshot command that detects clickable elements
that don't have proper ARIA roles but are interactive based on:
- cursor: pointer CSS style
- onclick attribute/handler
- tabindex attribute

This helps with modern web apps that use custom divs/spans as buttons.

Fixes #366

* fix: add cursor option to getSnapshot type signature
This commit is contained in:
Chris Tate
2026-02-04 23:44:58 -06:00
committed by GitHub
parent d34ce8c2d0
commit 74be667c80
9 changed files with 291 additions and 0 deletions
+8
View File
@@ -115,6 +115,7 @@ export class BrowserManager {
*/
async getSnapshot(options?: {
interactive?: boolean;
cursor?: boolean;
maxDepth?: number;
compact?: boolean;
selector?: string;
@@ -146,6 +147,13 @@ export class BrowserManager {
const page = this.getPage();
// Check if this is a cursor-interactive element (uses CSS selector, not ARIA role)
// These have pseudo-roles 'clickable' or 'focusable' and a CSS selector
if (refData.role === 'clickable' || refData.role === 'focusable') {
// The selector is a CSS selector, use it directly
return page.locator(refData.selector);
}
// Build locator with exact: true to avoid substring matches
let locator: Locator;
if (refData.name) {