Skip to content
Skillpedia
Web scraping29k Β· #9577

browser-automation

What it does

It gives the agent tools and patterns for controlling a browser with Playwright, for collecting data or completing repeated web tasks. It is for people automating web research, data collection or form work.

When to use it

  • βœ“When you want data collected from a website, such as a table or search results.
  • βœ“When you need a multi-step web task such as filling in forms or downloading files.
  • βœ“When you want screenshots or PDFs of web pages captured automatically.

Skill link

https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/browser-automation/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/alirezarezvani/claude-skills/blob/main/engineering/skills/browser-automation/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œI need you to collect the product names and prices from this store listing page into a spreadsheet.”

5 new skills a week. 1 minute to read.

How it works

The agent drives a browser with Playwright, waits for pages to load, extracts the content and saves the results. Helper scripts build scrapers and form flows.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Browser Automation - POWERFUL

Overview

The Browser Automation skill provides comprehensive tools and knowledge for building production-grade web automation workflows using Playwright. This skill covers data extraction, form filling, screenshot capture, session management, and anti-detection patterns for reliable browser automation at scale.

When to use this skill:

  • Scraping structured data from websites (tables, listings, search results)
  • Automating multi-step browser workflows (login, fill forms, download files)
  • Capturing screenshots or PDFs of web pages
  • Extracting data from SPAs and JavaScript-heavy sites
  • Building repeatable browser-based data pipelines

When NOT to use this skill:

  • Writing browser tests or E2E test suites β€” use playwright-pro instead
  • Testing API endpoints β€” use api-test-suite-builder instead
  • Load testing or performance benchmarking β€” use performance-profiler instead

Why Playwright over Selenium or Puppeteer:

  • Auto-wait built in β€” no explicit sleep() or waitForElement() needed for most actions
  • Multi-browser from one API β€” Chromium, Firefox, WebKit with zero config changes
  • Network interception β€” block ads, mock responses, capture API calls natively
  • Browser contexts β€” isolated sessions without spinning up new browser instances
  • Codegen β€” playwright codegen records your actions and generates scripts
  • Async-first β€” Python async/await for high-throughput scraping

Core Competencies

1. Web Scraping Patterns

Selector priority (most to least reliable):

  1. data-testid, data-id, or custom data attributes β€” stable across redesigns
  2. #id selectors β€” unique but may change between deploys
  3. Semantic selectors: article, nav, main, section β€” resilient to CSS changes
  4. Class-based: .product-card, .price β€” brittle if classes are generated (e.g., CSS modules)
  5. Positional: nth-child(), nth-of-type() β€” last resort, breaks on layout changes

Use XPath only when CSS cannot express the relationship (e.g., ancestor traversal, text-based selection).

Pagination strategies: next-button, URL-based (?page=N), infinite scroll, load-more button. See data_extraction_recipes.md for complete pagination handlers and scroll patterns.

2. Form Filling & Multi-Step Workflows

Break multi-step forms into discrete functions per step. Each function fills fields, clicks "Next"/"Continue", and waits for the next step to load (URL change or DOM element).

Key patterns: login flows, multi-page forms, file uploads (including drag-and-drop zones), native and custom dropdown handling. See playwright_browser_api.md for complete API reference on fill(), select_option(), set_input_files(), and expect_file_chooser().

3. Screenshot & PDF Capture

  • Full page: await page.screenshot(path="full.png", full_page=True)
  • Element: await page.locator("div.chart").screenshot(path="chart.png")
  • PDF (Chromium only): await page.pdf(path="out.pdf", format="A4", print_background=True)
  • Visual regression: Take screenshots at known states, store baselines in version control with naming: {page}_{viewport}_{state}.png

See playwright_browser_api.md for full screenshot/PDF options.

4. Structured Data Extraction

Core extraction patterns:

  • Tables to JSON β€” Extract <thead> headers and <tbody> rows into dictionaries
  • Listings to arrays β€” Map repeating card elements using a field-selector map (supports ::attr() for attributes)
  • Nested/threaded data β€” Recursive extraction for comments with replies, category trees

See data_extraction_recipes.md for complete extraction functions, price parsing, data cleaning utilities, and output format helpers (JSON, CSV, JSONL).

5. Cookie & Session Management

  • Save/restore cookies: context.cookies() and context.add_cookies()
  • Full storage state (cookies + localStorage): context.storage_state(path="state.json") to save, browser.new_context(storage_state="state.json") to restore

Best practice: Save state after login, reuse across scraping sessions. Check session validity before starting a long job β€” make a lightweight request to a protected page and verify you are not redirected to login. See playwright_browser_api.md

FAQ

Is this for testing websites?

No. Browser tests are covered by a different skill, playwright-pro.

Can it handle JavaScript-heavy sites?

Yes. It covers extracting data from single-page apps that load content with JavaScript.

Can it run on several browsers?

Yes. Playwright supports Chromium, Firefox and WebKit from one interface.

Details

Original description by the author

Use for browser automation, scraping, form filling or structured extraction from web pages. Builds scrapers with scraping_toolkit.py and form flows with form_automation_builder.py. Browser testing: playwright-pro.

repo: alirezarezvani/claude-skills

Popularity

GitHub stars
29k
Ranking position
#9577
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills