首页 > 解决方案 > Is there any solution to where I can check and handle if browser UI has been closed?

问题描述

I'm trying to do a handle check if the user closed the browser UI in the midst of the crawling automation. Is this possible?

I believe the it only allows everything to run entirely until the process ends at await browser.close();.

(async() => {
  const browser = await puppeteer.launch();
  // do something ...
  // if browser ui is closed/exit browser ui in midst of automation
  await browser.close();
})();

标签: node.jspuppeteer

解决方案


推荐阅读