Update class-page example code (#6379)

This commit is contained in:
Thomas Wang 2021-04-30 21:39:10 -07:00 committed by GitHub
parent 07fb81a4ef
commit af92565bc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -137,11 +137,11 @@ The arguments passed into `console.log` appear as arguments on the event handler
An example of handling `console` event:
```js
page.on('console', msg => {
page.on('console', async msg => {
for (let i = 0; i < msg.args().length; ++i)
console.log(`${i}: ${await msg.args()[i].jsonValue()}`);
});
page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
await page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
```
```java