mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs(README): add a debugging section (#2467)
This commit is contained in:
parent
e236887bbb
commit
afee0104be
22
README.md
22
README.md
@ -194,7 +194,27 @@ Explore the [API documentation](docs/api.md) and [examples](https://github.com/G
|
||||
|
||||
await page.evaluate(() => console.log(`url is ${location.href}`));
|
||||
|
||||
4. Enable verbose logging - All public API calls and internal protocol traffic
|
||||
4. Stop test execution and use a debugger in browser
|
||||
|
||||
- Use `{devtools: true}` when launching Puppeteer:
|
||||
|
||||
`const browser = await puppeteer.launch({devtools: true});`
|
||||
|
||||
- Change default test timeout:
|
||||
|
||||
jest: `jest.setTimeout(100000);`
|
||||
|
||||
jasmine: `jasmine.DEFAULT_TIMEOUT_INTERVAL = 100000;`
|
||||
|
||||
mocha: `this.timeout(100000);` (don't forget to change test to use [function and not '=>'](https://stackoverflow.com/a/23492442))
|
||||
|
||||
- Add an evaluate statement with `debugger` inside / add `debugger` to an existing evaluate statement:
|
||||
|
||||
`await page.evaluate(() => {debugger;});`
|
||||
|
||||
The test will now stop executing in the above evaluate statement, and chromium will stop in debug mode.
|
||||
|
||||
5. Enable verbose logging - All public API calls and internal protocol traffic
|
||||
will be logged via the [`debug`](https://github.com/visionmedia/debug) module under the `puppeteer` namespace.
|
||||
|
||||
# Basic verbose logging
|
||||
|
Loading…
Reference in New Issue
Block a user