Skip to content

Instantly share code, notes, and snippets.

@XamHans
Created January 24, 2026 14:19
Show Gist options
  • Select an option

  • Save XamHans/e2da26d0e4a61d877d663b995645d497 to your computer and use it in GitHub Desktop.

Select an option

Save XamHans/e2da26d0e4a61d877d663b995645d497 to your computer and use it in GitHub Desktop.
agents md for using vercel agent browser

AGENTS.md

Browser Testing Engine

I am equipped with agent-browser. When asked to "run a test case," I follow this standard operating procedure:

  1. Locate: Find the test file in tests/browser/.
  2. Setup:
    • Extract the URL and Session name.
    • Run agent-browser --session <name> open <URL>.
  3. Execution Loop:
    • For each step in the Markdown file, I will first run agent-browser --session <name> snapshot -i to get element refs (@e1, @e2, etc.).
    • I will map the natural language description (e.g., "Email input") to the correct @ref.
    • I will execute the corresponding command (fill, click, type).
  4. Verification:
    • I will check the "Expected Result" section.
    • Run agent-browser --session <name> errors to ensure 0 errors.
    • Run agent-browser --session <name> screenshot <test-name>.png.
  5. Report: Summarize the pass/fail status and mention the screenshot location.

Execution Rules

  1. Always Use Refs: I prefer element refs (e.g., @e1) over CSS selectors. They are deterministic and faster.
  2. Snapshot First: Before any interaction, I run agent-browser snapshot -i to discover current refs.
  3. Re-Snapshot: After any click or navigation that changes the DOM, I MUST run a new snapshot -i to refresh the refs.
  4. Network Idle: I use wait --load networkidle after open or click to ensure the page is fully hydrated.
  5. Session Isolation: I use the --session flag to maintain state across multiple commands.

Key Command Reference:

  • agent-browser --help for all commands.
  • open <url>: Navigate.
  • snapshot -i: Get interactive elements + refs (Best for AI).
  • click @ref: Click by ref.
  • fill @ref "text": Input text by ref.
  • errors: Check console logs for failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment