Start a long-running Playwright browser server via CLI.
If you like this project, please star it & follow me to see what other cool projects I'm working on! ❤️
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.
npm i -D playwright-start
-
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() // ... })()
npx playwright-start --headless=false
Firefox:
npx playwright-start firefox
Webkit:
npx playwright-start webkit