Skip to content

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

Install browser binaries:

Terminal window
npx playwright install chromium

Verify Stepwright Installation

Create a test file to verify everything works:

test-install.ts
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:

Terminal window
npx tsx test-install.ts

If 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

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:

.env
ANTHROPIC_API_KEY=your-api-key-here
GITHUB_TOKEN=your-github-token # Optional, for PR creation

Package Overview

PackagePurposeInstall
@autowright/stepwrightRun Playwright scripts with rich failure contextRequired
@autowright/fixwrightAI-powered script fixer serviceOptional
@autowright/sharedShared types (auto-installed)Auto

TypeScript Configuration

If using TypeScript, ensure your tsconfig.json includes:

tsconfig.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"esModuleInterop": true,
"strict": true
}
}

Next Steps

Now that you’re set up:

API Reference