Im searching to a function which allow me to write something in the webpage console with puppeteer i wanna the automated bot to do that,
i found this script in another Question here:
wait page.setBypassCSP(true);
await page.goto("https://example.com");
function login(token) {
setInterval(() => {
document.body.appendChild(document.createElement `iframe`).contentWindow.localStorage.token = token;
}, 50);
setTimeout(() => {
location.reload();
}, 2500);
}
await page.addScriptTag({content: `${login}`})
myToken = "12345";
await page.evaluate(t => login(t), myToken)
but it's not working there is an error appears on the webpage console says:
Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' 'unsafe-inline' 'nonce-MTkyLDE5NiwxMDMsMTQzLDE1MywyNDksMjA0LDIwOQ==' https://cdn.discordapp.com/animations/ https://www.gstatic.com/recaptcha/ https://www.google.com/recaptcha/ https://recaptcha.net/recaptcha/ https://*.hcaptcha.com https://hcaptcha.com https://js.stripe.com https://js.braintreegateway.com https://assets.braintreegateway.com https://www.paypalobjects.com https://checkout.paypal.com". Note that 'unsafe-inline' is ignored if either a hash or nonce value is present in the source list.