Home > database >  Blocked a frame with origin "https://dev.*******" from accessing a cross-origin frame
Blocked a frame with origin "https://dev.*******" from accessing a cross-origin frame

Time:02-15

I am getting errors whenever I run this code to load an iframe on cypress.

cy.frameLoaded('#connect__iframe')

cy.iframe('#connect__iframe')
  .find('button_Continue')
  .click()

})

})

CodePudding user response:

See the Cypress documentation:

If your site embeds an <iframe> that is a cross-origin frame, Cypress will not be able to automate or communicate with this <iframe>.

Examples of uses for cross-origin iframes

  • Embedding a Vimeo or YouTube video.
  • Displaying a credit card form from Stripe or Braintree.
  • Displaying an embedded login form from Auth0.
  • Showing comments from Disqus.

It's actually possible for Cypress to accommodate these situations the same way Selenium does, but you will never have native access to these iframes from inside of Cypress.

As a workaround, you may be able to use window.postMessage to directly communicate with these iframes and control them (if the 3rd party iframe supports it).

Other than that, you'll have to wait for us to implement APIs to support this (check our open issue), or you can disable web security.

CodePudding user response:

The destination server refuses the connection. Probably the website inserted in the iframe cannot be loaded. Read more here: https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

  • Related