Skip to content

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

docs: fix java console message snippet (#20171)

Yury Semikhatskyc36827433dd3
diff --git a/docs/src/api/class-consolemessage.md b/docs/src/api/class-consolemessage.md
index c415332577..19b8579fa6 100644
--- a/docs/src/api/class-consolemessage.md
+++ b/docs/src/api/class-consolemessage.md
@@ -28,16 +28,16 @@ await msg.args[1].jsonValue() // 42
```
```java
-// Listen for all System.out.printlns
+// Listen for all console messages and print them to the standard output.
page.onConsoleMessage(msg -> System.out.println(msg.text()));
-// Listen for all console events and handle errors
+// Listen for all console messages and print errors to the standard output.
page.onConsoleMessage(msg -> {
if ("error".equals(msg.type()))
System.out.println("Error text: " + msg.text());
});
-// Get the next System.out.println
+// Get the next console message
ConsoleMessage msg = page.waitForConsoleMessage(() -> {
// Issue console.log inside the page
page.evaluate("console.log('hello', 42, { foo: 'bar' });");