Skip to content

Latest commit

 

History

History
71 lines (54 loc) · 2.2 KB

File metadata and controls

71 lines (54 loc) · 2.2 KB
StepWright Logo

StepWright

A declarative, step-by-step approach to web automation and data extraction with Playwright.

Tests Coverage PyPI version

Overview

StepWright completely abstracts away the complexity of raw browser automation scripts. Instead of writing imperative page.locator(...).click() commands buried deep in try/except loops, StepWright allows you to define declarative scraping workflows using dictionaries or Python Dataclasses.

📚 Documentation

We have moved our documentation to a modern, searchable VitePress website to better accommodate Advanced Data Flows, Parallelism strategies, and complex interactions!

👉 Read the Official StepWright Documentation

Installation

pip install stepwright
playwright install chromium

Quick Look

import asyncio
from stepwright import run_scraper, TabTemplate, BaseStep

async def main():
    flow = TabTemplate(
        tab="search",
        steps=[
            BaseStep(id="nav", action="navigate", value="https://news.ycombinator.com"),
            BaseStep(
                id="extract",
                action="foreach",
                object=".athing",
                subSteps=[
                    BaseStep(id="title", action="data", object=".titleline", key="title")
                ]
            )
        ]
    )
    
    results = await run_scraper([flow])
    print(results)

if __name__ == "__main__":
    asyncio.run(main())

Developed with ❤️ by Muhammad Umer Farooq (@lablnet)