playwright-start
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

playwright-start Latest version Monthly downloads

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! ❤️

🙋‍♂️ 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

  1. Start a browser server from a separate terminal session:

    npx playwright-start
  2. 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

Package Sidebar

Install

npm i playwright-start

Weekly Downloads

20

Version

1.1.0

License

MIT

Unpacked Size

7.88 kB

Total Files

11

Last publish

Collaborators

  • hirokiosame