Browser automation

From elophanto/EloPhanto · View interactive version

Browser automation is an AI agent skill from the GitHub repository elophanto/EloPhanto. Comprehensive operational playbook for EloPhanto's 47 browser tools — strategies, workflows, decision trees, and patterns for reliable web automation across all task types.

How to use this skill

Skill file

Browser Automation

Description

Comprehensive operational playbook for EloPhanto's 47 browser tools — strategies, workflows, decision trees, and patterns for reliable web automation across all task types.

Triggers

Instructions

1. The Evidence Gating Rule (Non-Negotiable)

After ANY state-changing action, you MUST observe before your next action.

State-changing actions:

browser_click, browser_click_text, browser_click_batch, browser_click_at,

browser_type, browser_type_text, browser_press_key, browser_select_option,

browser_drag_drop, browser_drag_solve, browser_drag_brute_force,

browser_navigate, browser_go_back, browser_scroll, browser_scroll_container,

browser_eval (when it modifies DOM), browser_inject

Observation tools (pick the right one):

Anti-pattern: browser_click → browser_click → browser_type (two actions, no observation)

Correct: browser_click → browser_get_elements → browser_type → browser_extract

2. Task Type Strategy Selection

Choose your approach based on what you're doing:

Data Extraction (scraping, reading content)
  1. browser_navigate to the page
  2. browser_read_semantic for a structured overview of the content
  3. browser_extract for full text if you need everything
  4. browser_get_html if you need raw HTML, hidden attributes, or structured data
  5. For tables/lists, prefer browser_extract over browser_get_html
Form Filling (registration, checkout, data entry)
  1. browser_navigate to the form page
  2. browser_get_elements to map ALL form fields (inputs, selects, checkboxes)
  3. Fill fields in order using browser_type (by element index)
  4. For dropdowns: browser_select_option
  5. For checkboxes/radios: browser_select_option
  6. Observe after each field to catch validation errors
  7. Submit with browser_click_text on the submit button, or browser_press_key Enter
  8. Observe the result page to confirm success
Multi-Page Navigation (following links, paginated content)
  1. Start with browser_navigate
  2. Use browser_click_text for clearly labeled links ("Next", "Page 2")
  3. Use browser_click with index for links without clear text
  4. After each navigation, observe before proceeding
  5. For pagination, extract data from each page before navigating to the next
  6. Track your position — know which page you're on
Search and Find (looking for specific content)
  1. browser_navigate to the site
  2. browser_get_elements to find the search input
  3. browser_type the query, set enter=true to submit
  4. Observe the results with browser_extract or browser_read_semantic
  5. If results are paginated, follow the multi-page pattern
Monitoring (checking status, watching for changes)
  1. browser_navigate to the target page
  2. browser_extract or browser_read_semantic to capture current state
  3. For repeated checks, use the same observation tool each time
  4. Compare results between checks to detect changes
  5. Use browser_get_network to monitor API calls if the page loads data dynamically
Interactive Applications (dashboards, SPAs, web apps)
  1. browser_navigate — wait for the app shell to load
  2. browser_wait_for_selector for the main content area (SPAs often load asynchronously)
  3. browser_read_semantic to understand the app layout
  4. browser_get_elements to discover interactive controls
  5. For modals/dialogs: browser_scroll_container to scroll within them
  6. For tabs within the app: browser_click_text on tab labels

3. Tool Selection Decision Tree

"I need to reach another page on the site"

"I need to click something"

"I need to type something"

"I need to read the page"

"I need to inspect deeply"

"I need to wait for something"

"I need to debug"

4. Common Workflows

Login Flow (Full)
1. browser_navigate(url="https://example.com")
2. browser_get_elements → check if login form visible
   - If NO login form: already authenticated, proceed with task
   - If login form visible: continue
3. vault_lookup(service="example.com") → check stored credentials
   - If found: use them
   - If not found: ask user for credentials
4. browser_type(index=<email_field>, text="user@example.com")
5. browser_type(index=<password_field>, text="password123")
6. browser_click_text(text="Sign In") or browser_click_text(text="Log In")
7. browser_get_elements → verify login succeeded (no login form, user menu visible)
8. If 2FA/MFA prompt appears: ask user for the code, then browser_type it
Data Extraction with Pagination
1. browser_navigate(url="https://example.com/results")
2. browser_extract → capture page 1 data
3. browser_get_elements → find "Next" button
4. Loop:
   a. browser_click_text(text="Next")
   b. browser_wait_for_selector(selector=".results-loaded")
   c. browser_extract → capture page N data
   d. browser_get_elements → check if "Next" still exists
   e. If no Next button: done
Form with Validation
1. browser_navigate → load the form
2. browser_get_elements → map all fields
3. For each field:
   a. browser_type(index=N, text=value)
   b. browser_press_key(key="Tab") → trigger validation
   c. browser_get_elements → check for error messages
   d. If error: fix the value and retry
4. browser_click_text(text="Submit")
5. browser_extract → read success/error message
Viewing Local HTML Files
NEVER use file:// URLs — they do not work in the automated browser.
Instead, start a local HTTP server first:

1. shell_execute(command="cd /path/to/dir && python3 -m http.server 8080 &")
2. browser_navigate(url="http://localhost:8080/index.html")
3. When done, shell_execute(command="kill $(lsof -t -i:8080)") to stop the server
Download a File
1. browser_navigate → go to the download page
2. browser_click_text(text="Download") or browser_click on the download link
3. browser_wait(ms=3000) → wait for download to start
4. The file lands in Chrome's default download directory
Tab Management for Multi-Site Tasks
1. browser_navigate(url="https://site1.com") → opens in current tab
2. browser_extract → get data from site 1
3. browser_new_tab(url="https://site2.com") → opens site 2 in new tab
4. browser_extract → get data from site 2
5. browser_switch_tab(index=0) → go back to site 1
6. browser_close_tab(index=1) → close site 2 when done

5. Handling Tricky Situations

Modals and Dialogs
Infinite Scroll Pages
Single Page Applications (React, Vue, Angular)
Cookie Consent Banners
CAPTCHA / Challenge Pages
Iframes
Dynamic Content (AJAX, WebSockets)

6. Performance Patterns

Minimize Tool Calls
Prefer Selectors Over Fixed Waits
Use the Right Observation Tool

7. Debugging Strategies

When something isn't working:

  1. Take a screenshot — browser_screenshot gives you visual context
  2. Check console — browser_get_console for JavaScript errors
  3. Check network — browser_get_network for failed API calls or redirects
  4. Inspect the element — browser_inspect_element or browser_get_element_html for the specific element
  5. Search the DOM — browser_dom_search for text you expect to find
  6. Full audit — browser_full_audit for a comprehensive state dump

8. Security Awareness

Verify

Notes

The browser launches on first use (not at startup) and uses the user's real Chrome

profile when in profile mode. This means existing logins, cookies, extensions, and

bookmarks are all available. The browser bridge communicates via JSON-RPC over

stdin/stdout with a Node.js subprocess running Playwright with stealth plugins

for anti-detection.

Always-on failure modes (also in system prompt)

These survive even if this skill was only loaded as a summary excerpt:

  1. Task restart — After an interrupted prior task, treat browser state in

history as STALE. Navigate deliberately for the CURRENT user message.

  1. X/Twitter "Post" — Never browser_click_text('Post') to submit; it hits

the sidebar. Click the composer submit button by index. Replies use

browser_click_text('Reply', exact=True).

  1. Signup email — Always identity_status email; never invent an inbox.
  2. Evidence gating — Observe after every state-changing action.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.