Created
July 8, 2023 16:14
-
-
Save OJ7/71d2cae2a9233b098a2c9d7e6823311b to your computer and use it in GitHub Desktop.
Open Interactive Playwright in Node session (run code in real time in browser)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Run the following in your terminal: | |
* npm i playwright-firefox | |
* npx playwright install --with-deps | |
* node --experimental-repl-await | |
*/ | |
// Modify/paste the following in the interactive console: | |
const { firefox } = require('playwright-firefox'); | |
const BROWSER_DIR = '/full/path/to/dir'; # eg /Users/myuser/Documents/playwright-testing/ | |
const URL = 'https://playwright.dev/'; | |
const context = await firefox.launchPersistentContext(BROWSER_DIR, { | |
headless: false, | |
viewport: { width: 1280, height: 1280 }, | |
}); | |
const page = context.pages().length ? context.pages()[0] : await context.newPage(); | |
await page.goto(URL); | |
// ... perform interactive testing here ... | |
await browser.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment