https://github.com/nswbmw/puppeteer-debug
puppeteer-debug
https://github.com/nswbmw/puppeteer-debug
Last synced: 2 months ago
JSON representation
puppeteer-debug
- Host: GitHub
- URL: https://github.com/nswbmw/puppeteer-debug
- Owner: nswbmw
- Created: 2018-03-26T14:33:06.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-12-18T08:12:28.000Z (over 3 years ago)
- Last Synced: 2025-01-31T07:11:10.349Z (3 months ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
README
## puppeteer-debug
> Interrupt puppeteer/playwright for debug.
### Usage
#### puppeteer
```js
const puppeteer = require('puppeteer')
const debug = require('puppeteer-debug');(async () => {
const browser = await puppeteer.launch({
headless: false
})
const page = await browser.newPage()
await debug({ browser, page, ... }) // pass initial context(must be object) to REPL.
await browser.close()
})()
```#### playwright
```js
const playwright = require('playwright')
const debug = require('puppeteer-debug');(async () => {
const browser = await playwright.chromium.launch({
headless: false
})
const page = await browser.newPage()
await debug({ browser, page, ... }) // pass initial context(must be object) to REPL.
await browser.close()
})()
```In REPL:
```
> page.goto('https://google.com')
> page.type('input', 'hello, world!')
> page.click('input[type=submit]')
...
> this.page2 = await browser.newPage()
> this.page2.goto('https://google.com') // or page2.goto('https://google.com')
```Use `CTRL+C` exit REPL.
**NOTE**: If you define custom variables, please mount to `this`, eg: `this.xxx = yyy`
### License
MIT