【发布时间】:2021-10-28 06:38:59
【问题描述】:
如何将其他变量传递给page.on('dialog') 函数?
如何从函数中获得返回值?
page.on('dialog', async (dialog) => {
console('get additional variables:', param) // get additional variables
if (dialog.message() === param) {
res.isSuccess = true;
await dialog.accept();
}
else {
res.isSuccess = false;
await dialog.accept();
}
}, p);
console('get return:', res) // Need to get res.isSuccess
【问题讨论】:
-
这能回答你的问题吗? Puppeteer not picking up dialog box