当页面存在(或打开)时,我需要在页面上做一些动作。但是其他异步代码可以随时关闭它。我尝试使用代码,如下所示:
async.whilst(
function(){ /*TEST function: return true if page is opened or false otherwise*/},
function (cb){
(async()=>{
await page.evaluate(_=>{/*some code*/})
})();
},
callbackopt
)
我怎么知道页面是打开还是关闭,将此代码传递给测试功能?