有什么方法可以调试人偶脚本吗?由于某种原因,其中一个按钮没有被点击。我尝试了所有不同的方法,实际上在另一个脚本中我点击了它,但在这个脚本中我没有。
await page.focus('#outer-container > nav > span.right > span.search-notification-wrapper > span > form > input[type="text"]');
await page.type("Some text");
await page.click('#outer-container > nav > span.right > span.search-notification-wrapper > span > form'); // I am clicking on the form because it did work in the other script
原文由 elena 发布,翻译遵循 CC BY-SA 4.0 许可协议
有点迟到的反应,但作为参考可能会有所帮助。您可以像这样调试您的客户端脚本:
现在只需使用以下命令启动 puppeteer:
puppeteer.launch({devtools: true})
Chromium 将在您的断点处打开和停止。