Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

49
Views
How to close specific browser instance from puppeteer?

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.

7 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs