Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

Update class-page example code (#6379)

Thomas Wangaf92565bc7b8
diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md
index 164affe8dd..f95bf0bffb 100644
--- a/docs/src/api/class-page.md
+++ b/docs/src/api/class-page.md
@@ -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