Installation
Prerequisites
Before installing, ensure you have:
- Node.js 18.x or higher
- npm, pnpm, or yarn
- A project directory
Install Stepwright (Runner)
Stepwright is the core runner framework for writing Playwright automation scripts.
bash npm install @autowright/stepwright playwright
bash pnpm add @autowright/stepwright playwright
bash yarn add @autowright/stepwright playwright
Install browser binaries:
npx playwright install chromiumVerify Stepwright Installation
Create a test file to verify everything works:
import { Stepwright } from '@autowright/stepwright';
const script = Stepwright.create('Test Installation').step( 'Navigate', async (ctx) => { await ctx.page.goto('https://example.com'); console.log('Title:', await ctx.page.title()); });
script.run().then(() => console.log('Success!'));Run it:
npx tsx test-install.tsIf you see “Success!” and the page title, Stepwright is ready to go!
Install Fixwright (Optional - AI Fixer)
Fixwright is a separate service that uses AI to automatically fix failing scripts. It reads failure cases generated by Stepwright and creates pull requests with fixes.
bash npm install @autowright/fixwright bash pnpm add @autowright/fixwright bash yarn add @autowright/fixwright Fixwright Requirements
For AI-powered fixing with Fixwright, you’ll need:
- Anthropic API key - Get one here
- GitHub token (optional) - For automatic PR creation
Set up your environment:
ANTHROPIC_API_KEY=your-api-key-hereGITHUB_TOKEN=your-github-token # Optional, for PR creationPackage Overview
| Package | Purpose | Install |
|---|---|---|
@autowright/stepwright | Run Playwright scripts with rich failure context | Required |
@autowright/fixwright | AI-powered script fixer service | Optional |
@autowright/shared | Shared types (auto-installed) | Auto |
TypeScript Configuration
If using TypeScript, ensure your tsconfig.json includes:
{ "compilerOptions": { "target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "esModuleInterop": true, "strict": true }}Next Steps
Now that you’re set up:
- Quick Start - Write your first script
- Concepts - Learn the core concepts
API Reference
- Stepwright Class - Main runner API
- StepwrightConfig - Configuration options
- FixingLoop Class - AI fixer API