【发布时间】:2019-09-17 14:14:44
【问题描述】:
我正在使用的应用程序通过本机 Mac 对话框上传文件。我似乎无法让 Puppeteer 在这个盒子周围移动。我曾尝试使用 process.on(dialog)、page.keyboard.press 和 robotsjs,但这些选项似乎都无法访问此对话框。 process.on 永远不会被触发 page.keyboard 没有做任何事情,我认为是因为该框不在页面上 robotsjs ..我不知道为什么这也不起作用。
有没有人有任何其他建议或可行的解决方案我可以尝试?
page.on('dialog', async (dialog) => {
await robot.keyTap('tab');
await robot.typeString(filename);
await robot.keyTap('tab');
await robot.keyTap('tab');
await robot.keyTap('down');
await robot.keyTap('enter');
});
【问题讨论】:
标签: javascript node.js puppeteer