I see you're using node js. I would suggest that you kill all active running browsers/child-processes (
page.close()
and
browser.close()
are not enough especially when the script hangs).
When you launch a browser, get it's process id (
browser.pid
) and manually kill that process when you're done with the browser. You can use this library -
https://www.npmjs.com/package/tree-kill. So instead of
browser.close()
, do:
const kill = require('tree-kill');
const browserPid = browser.pid
kill(browserPid);
Use with caution though, only kill the process when you completely don't need the browser π