When 2 buttons are clicked, 2 puppeteer browser instances are opened. When another button is clicked, I only want it to kill one of the instances. However, currently, it kills both of the instances. The current code I am using is:
const browserPID = browser.process().pid;
console.log(browserPID + ' Browser PID')
ipcMain.on('stopOne', function(event, dName){
process.kill(browserPID);
//browser.disconnect();
//browser.close();
});
Is there any way this is possible? As seen above, I took the browser proceed pid and when the button is clicked, pass that value in process.kill, yet both instances are killed.