node.js - 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();
})();
解决方案
推荐阅读
- vue.js - “TypeError:filesys.existsSync 不是函数”
- reporting-services - 将 SSRS Tablix 过滤成 2 列,为菜单页面链接动态更新
- java - 如何在相对布局或任何布局中动态添加视图
- cmake - 如何在构建文件夹之外运行 CTest?
- c# - FOREIGN KEY 约束可能导致循环或多个级联路径。ef core 3(根本无法创建数据库)
- lua - 为什么我无法从本地脚本向服务器脚本发送已配备工具的信息?
- sql - 非单组函数查询错误
- java - 如何在运行时实例化接口?
- r - 删除数据框中的重复行
- google-bigquery - Google Cloud Big Query Scheduled Queries 与 JURISDICTION 相关的奇怪错误