playwright-scraper

Automate web scraping with Playwright using semantic selectors and error handling.

2|Updated Feb 27, 2026
One-click install
npx skills add https://github.com/nathanvale/side-quest-marketplace --skill playwright-scraper
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-scraper
Source: https://github.com/nathanvale/side-quest-marketplace/tree/main/plugins/scraper-toolkit/skills/playwright-scraper
Command: npx skills add https://github.com/nathanvale/side-quest-marketplace --skill playwright-scraper

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Production-proven Playwright web scraping patterns with selector-first approach and robust error handling.

Core Principles

  • Selector-first approach: Prefer semantic locators over brittle CSS.
  • Text extraction differences: Distinguish between visible text vs. raw text content.
  • Regex patterns: Robust extraction across newline boundaries.
  • Fallback hierarchy: Four-tier approach to extraction for resilience.
  • Error handling: Clear, actionable errors with timeouts.
  • Image selection: Semantic targeting for visuals.

Quick Start

Try basic scraping with Playwright using semantic selectors and safe extraction patterns.

Frequently Asked Questions about playwright-scraper

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a robust web scraper that handles dynamic pages?

Web scraping dynamic pages requires a browser automation tool like Playwright that executes JavaScript. Use semantic selectors over brittle CSS, apply multi-tier fallbacks for extraction, and implement comprehensive error handling with timeouts to reliably capture structured data from real-world websites.

What's the difference between innerText and textContent when extracting text from web pages?

innerText returns only visible text rendered on screen, while textContent captures all text including hidden content. Choosing correctly depends on your extraction goal: use innerText for user-visible content and textContent when you need raw HTML text regardless of display state.

How do I write regex patterns that work across newline boundaries in scraped content?

Regex patterns for multi-line content require the dotall or multiline flags to match across line breaks. In Playwright scraping workflows, apply regex after extracting text to handle inconsistent formatting and whitespace variations common in real-world HTML.

Can I use semantic locators instead of CSS selectors for web scraping?

Yes, semantic locators target elements by their role, label, or accessible name rather than fragile CSS class selectors. This approach is more resilient to page design changes and works better with modern web frameworks that frequently restructure the DOM.

What should I do when a web scraper fails on certain pages?

Implement a four-tier fallback hierarchy: try your primary selector, then alternative selectors, then regex patterns, then error handlers with actionable messages. This resilience strategy handles edge cases, missing elements, and layout variations without abandoning the scrape.

How do I select and extract images reliably during web scraping?

Use semantic targeting for images by matching alt text, title attributes, or parent element context rather than brittle src selectors. Pair this with error handling to gracefully skip missing or broken image URLs in your scraped dataset.