How do I configure Playwright to display console.log output in the HTML report?


To display console.log output in the HTML report, you need to configure Playwright with an HTML reporter. Here's how to do it:

Step 1: Create a Configuration File

Create a configuration file for your project, where you'll specify the reporter options.

import { defineConfig } from '@playwright/test';

export default defineConfig({
  reporter: [['html', { outputFolder: 'my-report' }]],

In this example, we're using the defineConfig function from the @playwright/test package to set the reporter property. We're specifying the 'html' reporter and providing an outputFolder option.

Step 2: Run Your Test Suite

Run your test suite using the npx playwright test command. Playwright will generate reports based on the configuration settings.


Customizing other aspects of reporting, like adding custom messages or logs during the testing process, requires creating custom reporters and more advanced knowledge of Playwright APIs.

Thank you!
Was this helpful?
Still have questions?

If you still have questions, please ask a question and I will try to answer it.

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.