Verified SOP & TutorialAudited Score 94/100

The Complete Production SOP: How to Deploy and Run Stealth Web Scraper & Harvester in Autonomous AI Agents

Production SOP to install and run Stealth Web Scraper & Harvester in Codex, Claude Code, and Cursor. Bypass bot walls, handle Playwright, and extract JSON.

Target Runtimes:codexclaude-codecursor
5 min read • Updated for 2026

Technical Overview & Architectural Context

Autonomous coding agents frequently fail at automated web data harvesting when encountering modern bot mitigation platforms like Cloudflare, DataDome, and perimeter WAFs. Without deterministic procedures, agents default to naive HTTP requests via curl, Python requests, or unshielded Playwright instances. These trigger immediate TLS and HTTP/2 fingerprint mismatches, fail canvas verification, expose automation flags like navigator.webdriver, and trap the agent in infinite CAPTCHA loops that consume excessive context tokens. The Stealth Web Scraper & Harvester skill enforces strict procedural boundaries across Codex, Claude Code, and Cursor. It commands the agent to provision isolated browser contexts with randomized platform fingerprints, inject anti-detection evasions prior to DOM creation, emulate humanized scrolling dynamics, and capture deterministic network-idle conditions. By structuring downstream data extraction through token-efficient DOM sanitation and strict schema validation, the skill eliminates context bloat while achieving reproducible data yields.

Prerequisites & Environment Requirements

Codex Desktop, Claude Code CLI, Cursor, or Windsurf installed with terminal execution privileges
Python 3.10+ and pip/uv installed in workspace sandbox
Playwright with Chromium engine binaries pre-installed (`playwright install chromium`)

Verified Search Intents & Long-Tail Queries Solved

SEO Audit Score: 99/100

This operational tutorial is engineered to provide deterministic solutions for these developer search queries:

#install stealth-scraper in cursor ide#claude code playwright stealth scraping rules#codex desktop stealth-scraper setup tutorial#how to fix playwright cloudflare bot detection agent error#deterministic data agent web scraping SOP#stealth-scraper sandbox permissions and security score#bypass bot check playwright automated agent trigger

Step-by-Step Execution Playbook

1

Local Skill Directory Mounting & SKILL.md Provisioning

Create the local skill manifest directory and inject verified procedural rules into agent runtime search paths.

Autonomous runtimes like Claude Code (`.claude/skills/`), Cursor (`.cursor/rules/`), and Codex scan predictable paths for standard SKILL.md definitions. We mount the skill into the global `~/.agents/skills/stealth-scraper` registry and symlink it to workspace configurations so triggers like 'scrape website' or 'bypass bot check' immediately map to deterministic Playwright automation protocols.

Terminal Command
mkdir -p ~/.agents/skills/stealth-scraper && curl -fsSL https://askills.dev/api/skills/stealth-scraper/raw -o ~/.agents/skills/stealth-scraper/SKILL.md
SKILL.md
---
name: "stealth-scraper"
description: "Harvest dynamic websites using Playwright with anti-detection headers, natural scroll, and structured JSON extraction."
triggers:
  - "scrape website"
  - "extract table data"
  - "crawl ecommerce"
  - "bypass bot check"
---

# Stealth Scraper Procedural SOP
1. Always launch Chromium with `--disable-blink-features=AutomationControlled`.
2. Apply realistic user-agents matching client platform OS.
3. Evaluate page.evaluate("() => delete Object.getPrototypeOf(navigator).webdriver") prior to navigation.
4. Wait for `domcontentloaded` followed by network idle event; avoid arbitrary sleep timers.
5. Extract required content via deterministic CSS/XPath selectors and parse to clean markdown/JSON.
Production Pro-Tip

Instruct your agent to execute extraction scripts in a decoupled subprocess and emit raw JSON to disk, rather than streaming raw HTML directly into agent conversational context.

Sandbox Gotcha

In containerized agent sandboxes (e.g. Codex or Docker devcontainers), ensure `--no-sandbox` and `--disable-dev-shm-usage` flags are set in the Playwright launch arguments to avoid silent browser crashes.

2

Dependency Validation & Chromium Engine Provisioning

Validate Python runtime virtual environment and install core anti-detection dependencies.

Stealth scraping requires headless browser binaries alongside DOM parsing utilities. The agent must verify that Playwright, BeautifulSoup4, and Fake-UserAgent are active in the virtual environment. Missing system libraries for Chromium will break execution at runtime.

Terminal Command
pip install playwright beautifulsoup4 fake-useragent && playwright install chromium --with-deps
harvest_runner.py
import asyncio
from playwright.async_api import async_playwright
from fake_useragent import UserAgent

async def run_stealth_session(url: str):
    ua = UserAgent(platforms='desktop')
    async with async_playwright() as p:
        browser = await p.chromium.launch(
            headless=True,
            args=['--disable-blink-features=AutomationControlled', '--no-sandbox']
        )
        context = await browser.new_context(
            user_agent=ua.random,
            viewport={'width': 1920, 'height': 1080},
            locale='en-US'
        )
        page = await context.new_page()
        await page.add_init_script("Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
        await page.goto(url, wait_until='networkidle')
        content = await page.content()
        await browser.close()
        return content
Production Pro-Tip

Always lock browser launch arguments to headless=True with explicitly set realistic viewports (1920x1080) to avoid bot triggers caused by default 800x600 headless window dimensions.

Sandbox Gotcha

Failure to run `playwright install --with-deps` will cause shared library loading errors (libnss3, libatk) inside minimal Ubuntu/Debian sandboxes.

3

Trigger Activation & Deterministic Script Synthesis

Invoke the stealth-scraper skill via matched natural language prompts to generate targeted scraping scripts.

Provide high-intent requests to Codex or Claude Code referencing the skill's triggers. The agent evaluates the SKILL.md boundary rules, avoids standard request libraries, and crafts an end-to-end extraction script adhering strictly to pagination limits and DOM sanitization.

Terminal Command
claude "crawl ecommerce https://example.com/products and extract table data into clean JSON adhering to stealth-scraper rules"
Production Pro-Tip

Specify output schema constraints directly in the invocation prompt (e.g., 'produce outputs conforming to Pydantic models') to keep responses token-efficient.

Sandbox Gotcha

Do not instruct the agent to crawl deep recursive links without an explicit max_depth or max_pages limit, or the agent may loop indefinitely.

4

Verification, Linting & Schema Enforcement Quality Gate

Execute automated self-healing checks and validate harvested JSON against expected schemas.

The skill mandates a quality gate where the agent runs the generated scraper against a local mock or the live target, checks the exit code, and lints the output data structure before marking the task complete.

Terminal Command
python3 harvest_runner.py && jq . output.json > /dev/null && echo 'Quality Gate Passed'
Production Pro-Tip

Review the generated git diff or script output with `git diff --stat` before confirming agent task completion in interactive Cursor workflows.

Sandbox Gotcha

Ensure that `jq` or Python JSON parsers do not fail on unescaped HTML characters inside raw scraped strings.

Real-World Scenario: Bypassing WAF & Harvesting Dynamic SaaS Pricing Tables to Structured JSON

Tested Trigger Prompt (Feed directly into Codex, Claude, or Cursor):

“Scrape website https://bot.sannysoft.com and dynamic SaaS pricing tiers. Bypass bot checks using stealth-scraper SOP, handle lazy loading via humanized scroll, and output tier names, monthly costs, and feature arrays to data/pricing.json.”

Deterministic Agent Verification Pipeline:
Agent matches 'scrape website' and 'bypass bot check' triggers, loading the stealth-scraper SKILL.md SOP.
Agent synthesizes a Python Playwright script configuring `navigator.webdriver` overrides, randomized desktop User-Agent, and step-wise mouse/scroll emulation.
Script executes headless browser, scrolls viewport by increments of 300px to trigger dynamic DOM mutations, and waits for network idle state.
Agent applies BeautifulSoup to parse clean semantic tags, sanitizes raw text, and saves structured records into data/pricing.json without emitting noisy DOM dumps into context.
Agent runs a verification step checking that data/pricing.json exists, is valid JSON, and contains non-empty pricing tier objects.

Runtime Troubleshooting & Failure Modes

Error: playwright._impl._errors.TimeoutError: Page.goto: Timeout 30000ms exceeded while waiting for event "networkidle"

Root Cause: Continuous background polling or WebSocket traffic on modern dynamic websites prevents the Playwright networkidle event from ever triggering within standard 30-second windows.

Resolution Command / Fix:
await page.goto(url, wait_until='domcontentloaded', timeout=15000)
await page.wait_for_selector('main, article, table', timeout=10000)
Error: Error: Host system is missing dependencies! Missing libraries: libatk-1.0.so.0, libnss3.so

Root Cause: Chromium dependencies were omitted during runtime provisioning inside the isolated agent sandbox environment.

Resolution Command / Fix:
playwright install-deps chromium

Frequently Asked Questions (Stealth Web Scraper & Harvester SOP)

Q:Can I use Stealth Web Scraper & Harvester across Codex, Claude Code, and Cursor simultaneously?

Yes. The skill adheres to the universal SKILL.md specification. Place it inside `~/.agents/skills/stealth-scraper` or symlink it into project-specific `.cursor/rules/` and `.claude/skills/` directories for seamless cross-runtime activation.

Q:How does Stealth Web Scraper & Harvester prevent context window overflow during long agent sessions?

The SOP commands the agent to dump raw web assets directly to local files and use targeted CSS/XPath queries to output minimal structured JSON, avoiding the ingestion of massive raw HTML documents into LLM context tokens.

Q:Does this skill require escalated root or container permissions?

No. The skill is audited with a 94/100 security score and runs entirely in user-space using workspace-scoped virtual environments, provided required Chromium shared libraries are installed on the host.

Ready to equip your autonomous agent with Stealth Web Scraper & Harvester?

Copy the complete audited SKILL.md specification or download the 1-click zip bundle directly from our verified registry.

Get 1-Click Install Spec