playwright-start
playwright-start copied to clipboard
Start a long-running Playwright browser server via CLI
playwright-start

Start a long-running Playwright browser server via CLI.
Support this project by ⭐️ starring and sharing it. Follow me to see what other cool projects I'm working on! ❤️
🙋♂️ Why?
When developing browser automation scripts, there's a lot of overhead in browser start up every time you test a change.
Start a long-running browser server in a separate window and connect to it from your script to iterate faster! The CLI also comes with a REPL to help you quickly test code.
🚀 Install
npm i -D playwright-start
🚦 Quick Setup
-
Start a browser server from a separate terminal session:
npx playwright-start
-
Connect from your code:
import { ChromiumBrowser, devices, } from 'playwright' import connect from 'playwright-start' (async () => { const browser = await connect<ChromiumBrowser>() const context = await browser.newContext({ // Emulate Pixel 2 XL ...devices['Pixel 2 XL'] }) const page = await context.newPage() // ... })()
👨🏫 Examples
Starting a non-headless Chromium server
npx playwright-start --headless=false
Starting a Firefox or Webkit server
Firefox:
npx playwright-start firefox
Webkit:
npx playwright-start webkit