1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Cypress - reCaptcha load error: Refused to load the script because it violates the following...

Discussão em 'Angular' iniciado por mindparse, Setembro 17, 2024.

  1. mindparse

    mindparse Guest

    I am needing to get a reCaptcha token for my site key as part of some data setup steps in a test scenario.

    I am using cucumber step definitions, and have the following:

    import { load } from 'recaptcha-v3'

    Then('retrieve reCaptacha token', function () {
    load('<sitekey>').then((recaptcha) => {
    cy.log(recaptcha.getSiteKey())
    recaptcha
    .execute('submit')
    .then((token) => {
    cy.log(token);
    }).catch((err) => {
    cy.log(err)
    });
    }).catch((err) => {
    cy.log(err)
    })
    });


    When Cypress invokes this, I see the following error:

    Refused to load the script 'https://www.google.com/recaptcha/api.js?render=explicit' because it violates the following Content Security Policy directive: "script-src 'unsafe-eval'". Note that 'script-src-elem' was not explicitly set, so 'script-src' is used as a fallback.


    I suspect I am mis-using this somehow inside the Cypress test runner, what do I need to do to get past this?

    Continue reading...

Compartilhe esta Página