mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
readme: add console event debugging tip (#481)
This commit is contained in:
parent
a526e9f9fb
commit
7e1f2f0609
13
README.md
13
README.md
@ -120,6 +120,19 @@ Explore the [API documentation](docs/api.md) and [examples](https://github.com/G
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
2. Capture console output from the page by listening for the `console` event.
|
||||||
|
This is also handy when debugging code in `page.evaluate()`:
|
||||||
|
|
||||||
|
```js
|
||||||
|
page.on('console', (...args) => {
|
||||||
|
console.log('PAGE LOG:', ...args);
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.evaluate(() => {
|
||||||
|
console.log(`url is ${location.href}`);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing to Puppeteer
|
## Contributing to Puppeteer
|
||||||
|
|
||||||
Check out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.
|
Check out [contributing guide](https://github.com/GoogleChrome/puppeteer/blob/master/CONTRIBUTING.md) to get an overview of Puppeteer development.
|
||||||
|
Loading…
Reference in New Issue
Block a user