effect-playwright
    Preparing search index...

    Interface ConsoleMessage

    ConsoleMessage objects are dispatched by page via the page.on('console') event. For each console message logged in the page there will be corresponding event in the Playwright context.

    // Listen for all console logs
    page.on('console', msg => console.log(msg.text()));

    // Listen for all console events and handle errors
    page.on('console', msg => {
    if (msg.type() === 'error')
    console.log(`Error text: "${msg.text()}"`);
    });

    // Get the next console log
    const msgPromise = page.waitForEvent('console');
    await page.evaluate(() => {
    console.log('hello', 42, { foo: 'bar' }); // Issue console.log inside the page
    });
    const msg = await msgPromise;

    // Deconstruct console log arguments
    await msg.args()[0].jsonValue(); // hello
    await msg.args()[1].jsonValue(); // 42
    interface ConsoleMessage {
        args(): JSHandle<any>[];
        location(): {
            column: number;
            columnNumber: number;
            line: number;
            lineNumber: number;
            url: string;
        };
        page(): Page | null;
        text(): string;
        timestamp(): number;
        type(): | "log"
        | "table"
        | "time"
        | "count"
        | "clear"
        | "error"
        | "trace"
        | "debug"
        | "info"
        | "warning"
        | "dir"
        | "dirxml"
        | "startGroup"
        | "startGroupCollapsed"
        | "endGroup"
        | "assert"
        | "profile"
        | "profileEnd"
        | "timeEnd";
        worker(): Worker | null;
    }
    Index
    • List of arguments passed to a console function call. See also page.on('console').

      Returns JSHandle<any>[]

    • Returns {
          column: number;
          columnNumber: number;
          line: number;
          lineNumber: number;
          url: string;
      }

      • column: number

        0-based column number in the resource.

      • columnNumber: number

        0-based column number in the resource. Deprecated, use column instead.

      • line: number

        0-based line number in the resource.

      • lineNumber: number

        0-based line number in the resource. Deprecated, use line instead.

      • url: string

        URL of the resource.

    • The page that produced this console message, if any.

      Returns Page | null

    • The text of the console message.

      Returns string

    • The timestamp of the console message in milliseconds since the Unix epoch.

      Returns number

    • Returns
          | "log"
          | "table"
          | "time"
          | "count"
          | "clear"
          | "error"
          | "trace"
          | "debug"
          | "info"
          | "warning"
          | "dir"
          | "dirxml"
          | "startGroup"
          | "startGroupCollapsed"
          | "endGroup"
          | "assert"
          | "profile"
          | "profileEnd"
          | "timeEnd"

    • The web worker or service worker that produced this console message, if any. Note that console messages from web workers also have non-null consoleMessage.page().

      Returns Worker | null