A declarative, step-by-step approach to web automation and data extraction with Playwright.
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.
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
pip install stepwright
playwright install chromiumimport 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)
