inyectar jquery en la página del titiritero
Estoy tratando de inyectar jquery en mi página de titiriteros porque document.querySelector no me lo corta:
async function inject_jquery(page){
await page.evaluate(() => {
var jq = document.createElement("script")
jq.src = "https://code.jquery.com/jquery-3.2.1.min.js"
document.querySelector("head").appendChild(jq)
})
const watchDog = page.waitForFunction('window.jQuery !== undefined');
await watchDog;
}
El resultado es que la mayoría de las veces se agota. ¿Alguien tiene una solución?