title: puppeteer : how check if browser is still open and working
body: <p>im trying to open multiple tabs in a single browser instance  , after they're done i close the tabs and then re-opening those tabs every x seconds ... but i want to keep the browser itself open so i dont have to login in each tab on every loop</p>
  
  <p>so the browser remains open , tabs open and close </p>
  
  <p>here is my simplified code  , pleas ignore syntax erros </p>
  
  <pre><code>var  global_browser = false ;
  async function init_puppeteer( settings ) {
  
  
  
      if(global_browser === false )
          global_browser = await puppeteer.launch({headless: false  , args:['--no-sandbox']});
  
      for(var i = 0  ; i &lt; settings.length ; i++ )
      {
          var setting = settings[i];
          open_tab($setting);
      }
  }
  
  
  
   async function open_tab( setting ){
      const page    = await global_browser.newPage();
      // do stuff 
      page.close();   
  }
  
  setInterval(function (){
      init_puppeteer(settings)
  }, 50000 );
  </code></pre>
  
  <p>here is the problem , sometimes browser crashes or it get closed for whatever reason but the <code>global_browser</code> remains an object /instance of puppeteer  ... of curse it wont work when i try open a tab with that instance  , and i get something like</p>
  
  <pre><code>(node:5720) UnhandledPromiseRejectionWarning: Error: WebSocket is not open: readyState 3 (CLOSED)
  </code></pre>
  
  <p>here is my question , how can i check and make sure i have a working/open instance of puppeteer in <code>global_browser</code> ? so i can create a new instance and replace it if the previous one is closed</p>