[BUG] process.send() not working in playwright
See original GitHub issue[Context:]
- Playwright Version: [1.25.2]
- Operating System: [1.25.2]
- Node.js version: [14.17.5]
- Browser: [Chromium]
I am trying to run playwright test by spawning a child process using child_process library
Code Snippet
//parent.js
const { spawn } = require("child_process");
var proc = spawn("npx", ["playwright","test","tests/example.spec.js"], {
shell: true,
stdio: ['ipc']
});
proc.stdout.on("data", (data) => {
console.log("stdout: " + data); //this works
});
proc.on('message', function (message) {
console.log(message) // this doesn't work
})
//inside example.spec.js(playwright test file)
process.send("Hello from child") // doesn't work
Describe the bug
At times, I get an error saying that process.send is not a function.

Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
navigation failed because page was closed! - You.com
Running the Firefox build of Playwright from ms-playwright/firefox/firefox.exe and manually opening the website also works fine. However, whenever I try to run ...
Read more >What Is Playwright – A Tutorial on How to Use ... - LambdaTest
Run your Playwright test scripts instantly on 50+ browser and OS ... A cloud-based Playwright automation testing cloud-like LambdaTest solves the problems ......
Read more >Browser.Playwright — RPA Framework documentation
Compared to Selenium, these do not require their own browser process. To get a clean environment a test can just open a new...
Read more >Puppeteer and Playwright chrome headful bugs when making ...
These phenomena are related to Chromium itself and not Puppeteer nor Playwright. If you are suffering from performance issues during ...
Read more >Perl client for Playwright - metacpan.org
However, depending on your node installation this may not work due to ... an await() with playwright-perl you are waiting on a remote...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The code above tries to open IPC channel between
my-serverand playwright test runner process, each test runs in a worker process spawned by the test runner process. So even if you open an IPC channel to the test runner you’ll still have to route the messages to workers. To avoid all of that it’d be easier to establish a connection (IPC or even http?) between the tests andmy-serverdirectly. If you only need to send messages from the tests tomy-serveryou can probably get away with writing to stdout/stderr in the tests (with some unique prefix) and then reading that stream inmy-server.I’m going to close this bug as we are not planning to change current IPC mechanism used by the test runner.
Thanks for writing @yury-s.
My idea was actually to trigger playwright tests via an API call.
I am spawning a child process and running playwright tests inside it.
And while doing so, I want to send some messages like data from the UI, etc… from my playwright child process to my parent process i.e. my API so that I can send those messages in my API response which will be used by other services.
So, for example -