How can I get the pid of a browser launched with Playwright ?
I tried : browser.process().pid
but it did not work unfortunately.
You cannot apply process()
on browser
context but only on browserServer
, which requires a launchServer()
first place (and not regular launch()
). see the docs about browserServer.process().
You will need to launch the server like this to get an instance with a valid pid
:
const browserServer = await playwright.chromium.launchServer()
const pid = await browserServer.process().pid
console.log(pid)