docs(consoleMessage): add missing console message comments (#6320)
Co-authored-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
parent
90de864216
commit
9e36f5cc26
|
|
@ -5,6 +5,8 @@
|
||||||
## method: ConsoleMessage.args
|
## method: ConsoleMessage.args
|
||||||
- returns: <[Array]<[JSHandle]>>
|
- returns: <[Array]<[JSHandle]>>
|
||||||
|
|
||||||
|
List of arguments passed to a `console` function call. See also [`event: Page.console`].
|
||||||
|
|
||||||
## method: ConsoleMessage.location
|
## method: ConsoleMessage.location
|
||||||
* langs: js, python
|
* langs: js, python
|
||||||
- returns: <[Object]>
|
- returns: <[Object]>
|
||||||
|
|
@ -21,6 +23,8 @@ URL of the resource followed by 0-based line and column numbers in the resource
|
||||||
## method: ConsoleMessage.text
|
## method: ConsoleMessage.text
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
|
The text of the console message.
|
||||||
|
|
||||||
## method: ConsoleMessage.type
|
## method: ConsoleMessage.type
|
||||||
- returns: <[string]>
|
- returns: <[string]>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ await page.evaluate(() => console.log('hello', 5, {foo: 'bar'}));
|
||||||
```
|
```
|
||||||
|
|
||||||
```java
|
```java
|
||||||
page.onConsole(msg -> {
|
page.onConsoleMessage(msg -> {
|
||||||
for (int i = 0; i < msg.args().size(); ++i)
|
for (int i = 0; i < msg.args().size(); ++i)
|
||||||
System.out.println(i + ": " + msg.args().get(i).jsonValue());
|
System.out.println(i + ": " + msg.args().get(i).jsonValue());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,10 @@ await msg.args[1].jsonValue() // 42
|
||||||
|
|
||||||
```java
|
```java
|
||||||
// Listen for all System.out.printlns
|
// Listen for all System.out.printlns
|
||||||
page.onConsole(msg -> System.out.println(msg.text()));
|
page.onConsoleMessage(msg -> System.out.println(msg.text()));
|
||||||
|
|
||||||
// Listen for all console events and handle errors
|
// Listen for all console events and handle errors
|
||||||
page.onConsole(msg -> {
|
page.onConsoleMessage(msg -> {
|
||||||
if ("error".equals(msg.type()))
|
if ("error".equals(msg.type()))
|
||||||
System.out.println("Error text: " + msg.text());
|
System.out.println("Error text: " + msg.text());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
7
types/types.d.ts
vendored
7
types/types.d.ts
vendored
|
|
@ -9036,6 +9036,10 @@ export interface BrowserServer {
|
||||||
* [page.on('console')](https://playwright.dev/docs/api/class-page#pageonconsole) event.
|
* [page.on('console')](https://playwright.dev/docs/api/class-page#pageonconsole) event.
|
||||||
*/
|
*/
|
||||||
export interface ConsoleMessage {
|
export interface ConsoleMessage {
|
||||||
|
/**
|
||||||
|
* List of arguments passed to a `console` function call. See also
|
||||||
|
* [page.on('console')](https://playwright.dev/docs/api/class-page#pageonconsole).
|
||||||
|
*/
|
||||||
args(): Array<JSHandle>;
|
args(): Array<JSHandle>;
|
||||||
|
|
||||||
location(): {
|
location(): {
|
||||||
|
|
@ -9055,6 +9059,9 @@ export interface ConsoleMessage {
|
||||||
columnNumber: number;
|
columnNumber: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text of the console message.
|
||||||
|
*/
|
||||||
text(): string;
|
text(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue