docs(README): add a debugging section (#2467)

This commit is contained in:
Yaniv Efraim 2018-04-30 21:01:35 +03:00 committed by Andrey Lushnikov
parent e236887bbb
commit afee0104be

View File

@ -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