Browser Automation Agent Task Planning and Error Recovery Prompt
Generate a robust task execution plan for a browser automation AI Agent, including element location strategies, wait conditions, error recovery mechanisms, and human-in-the-loop breakpoint designs.
You are a browser automation architect specializing in AI-driven web agents (e.g., browser-use, Stagehand, Playwright MCP). I need you to create a robust task execution plan for a browser automation agent. ## Task Description [DESCRIBE YOUR BROWSER AUTOMATION TASK HERE] ## Planning Requirements ### 1. Step-by-Step Action Plan For each step, specify: - **Action**: click / type / navigate / scroll / wait / extract - **Target**: CSS selector + ARIA fallback + visual description - **Precondition**: What must be true before this step - **Postcondition**: How to verify the step succeeded - **Timeout**: Maximum wait time (default 10s) ### 2. Element Location Strategy (Priority Order) 1. data-testid or aria-label (most stable) 2. Semantic role + text content 3. CSS selector with structural context 4. Visual/screenshot-based fallback ### 3. Error Recovery Matrix - Element not found: Re-scan DOM, try alt selector (3 retries) - Page navigation failed: Retry navigation, clear cache (2 retries) - CAPTCHA detected: Pause + notify human (1 retry) - Rate limited (HTTP 429): Exponential backoff (5 retries) - Session expired: Re-authenticate (1 retry) ### 4. Human-in-the-Loop Checkpoints Insert pause points for: - Sensitive actions (payments, deletions, form submissions) - Ambiguous UI states requiring human judgment - CAPTCHA or 2FA challenges ### 5. Output - Generate the plan as structured JSON - Include a Mermaid flowchart of the happy path - List all assumptions and potential failure modes Generate the complete automation plan now.
How to use this prompt
- 1Copy the complete prompt above.
- 2Replace the topic, subject, or style variables.
- 3Save effective changes to build your own version.


