我需要用无头模式刮一个网站有很多debugger;
有办法防止调试器暂停吗?
我尝试发送加载CTRL+F8和F8与此代码,但没有成功!
await crt_page.keyboard.down('Control');
await crt_page.keyboard.press('F8');
await crt_page.keyboard.up('Control');
await crt_page.keyboard.press('F8');
字符串
有什么建议吗?
我需要用无头模式刮一个网站有很多debugger;
有办法防止调试器暂停吗?
我尝试发送加载CTRL+F8和F8与此代码,但没有成功!
await crt_page.keyboard.down('Control');
await crt_page.keyboard.press('F8');
await crt_page.keyboard.up('Control');
await crt_page.keyboard.press('F8');
字符串
有什么建议吗?
2条答案
按热度按时间eoxn13cs1#
Puppeteer会自动按下
page
内部的键,而不是浏览器。所以我认为解决方案是安装一个npm包
robotjs
来做浏览器之外的事情。希望这对你有帮助!
如果这段代码有效的话,别忘了选择我的答案作为正确答案。
字符串
要调试你的robotjs,它是否工作,请尝试此代码。
下面的代码运行puppeteer并使用
robotjs
更改URL。如果这也不能在您的服务器上工作,那么很抱歉我不能帮助你。
型
ipakzgxi2#
我在抓取一些js中包含
debug
语句的页面时遇到了一些困难。我刚把开发工具改成了false。开发工具窗格不在那里,调试语句不会导致问题。
字符串