我在尝试用Puppeteer:将jQuery脚本注入浏览器时遇到了这个错误
此文档需要"TrustedScript"分配
当我使用时
await page.addScriptTag({url: "https://code.jquery.com/jquery-3.2.1.min.js" });
await page.addScriptTag({ path: './jquery-3.2.1.min.js' });
await page.addScriptTag({ content: jquery });
你知道如何注入jQuery吗?
正如@pguardianio所说,它将是:
await page.setBypassCSP(true);
相信我的话,兄弟们。这是我在尝试了几个小时的不同方法并在网上广泛搜索后,在一条小评论中发现的价值百万美元的一句话。叹气有时候简单的事情很难弄清楚。