Playwright: [BUG] dumpio no longer seems to be an option when launching

Created on 24 Apr 2020  路  5Comments  路  Source: microsoft/playwright

Context:

  • Playwright Version: 0.15.0
  • Operating System: macOS

Code Snippet

const browser = await playwright[browserType].launch({ headless: false, dumpio: true });

Describe the bug

This was not a compile error before (0.12.1), but seems now.

Most helpful comment

Debug logging is now configured via the environment:

DEBUG=pw:browser* node test.js

And for more complex scenarios you can use the logger sink in the api.

All 5 comments

Hey,

dumpio was removed (#1861) in 0.14 and replaced by the logger sink API. Unfortunately not mentioned in the docs directly with the dumpio keyword.

Example Usage: https://playwright.dev/#version=v0.15.0&path=docs%2Fapi.md&q=class-logger

@mxschmitt thanks, what would be an example for getting the dumpio: true behaviour?

@mxschmitt thanks, what would be an example for getting the dumpio: true behaviour?

Probably something like that: https://try.playwright.tech/?s=71xa6

Code:

const playwright = require("playwright");

(async () => {
  const browser = await playwright.chromium.launch({
    logger: {
      isEnabled: () => true,
      log: (name, severity, message, args) => console.log(name, message)
    }
  });
  const context = await browser.newContext();
  const page = await context.newPage();
  await page.goto('https://code.visualstudio.com');
  await page.screenshot({ path: `example.png` });
  await browser.close();
})();

That will lead to that all messages will be logged to the console.

Via the isEnabled callback, you can filter if you only want to get browser or protocol logs.

Thanks, I will give that a try.

Debug logging is now configured via the environment:

DEBUG=pw:browser* node test.js

And for more complex scenarios you can use the logger sink in the api.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andyricchuiti picture andyricchuiti  路  4Comments

shirshak55 picture shirshak55  路  3Comments

VikramTiwari picture VikramTiwari  路  4Comments

saltyshiomix picture saltyshiomix  路  3Comments

etnbrd picture etnbrd  路  4Comments