← Back to Discord Forum

Howto capture (custom browser binary path) stderr and stdout to a file.

ASSERTION FAILED: !(newRadii.topLeft().width() && newRadii.topRight().width())

DEBUG=pw:browser* node script.js

var access = fs.createWriteStream(std.log);
process.stdout.write = process.stderr.write = access.write.bind(access);
logger: {
        isEnabled: (name, severity) => name === 'browser',
        log: (name, severity, message, args) => console.log(`${name} ${severity} ${message}`)


Seems to don't work, some times captures just few lines of the Assertion output or SEGV message.

This thread is trying to answer question "How can I successfully capture stderr and stdout to a file using a custom browser binary path?"

0 replies


Capturing Output to a File with a Custom Browser Binary Path in Playwright

First, you need to specify the custom browser binary path. Use the executablePath option when launching the browser. This allows you to run a specific browser executable instead of the bundled one. Here's how to do it:

const { chromium } = require('@playwright/test');

async function captureOutputToFile() {
  const browser = await chromium.launch({
    executablePath: 'https://ray.run/path/to/custom/browser',

  // Your code here...

  await browser.close();


Next, you'll want to capture stderr and stdout output and redirect them to a file. You can do this using shell redirection operators when running your script. For example:

node my_script.js > output.txt

The > operator overwrites any existing content in output.txt, while >> appends new content. To capture both stderr and stdout into separate files, use different operators for each stream:

node my_script.js > stdout.txt 2> stderr.txt

If you want both streams combined into one file while preserving their order, use:

node my_script.js > combined_output.txt 2>&1

Remember to replace my_script.js with the name of your Playwright script. Now you're all set to capture stderr and stdout output to a file using a custom browser binary path in Playwright!

Related Discord Threads

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.