Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
How can I write something in the webpage with puppeteer

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.
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!