Can anyone help me render the iFrame for the following page in Cypress.
Question posted in Javascript
A very good W3school tutorial can be found here.
A very good W3school tutorial can be found here.
Can anyone help me render the iFrame for the following page in Cypress.
2
Answers
Here’s an example of how to render the link in iframe using Cypress;
So in the above test, the specified url is visited using
cy.visit
, thency.get('iframe')
to locate the iframe element. We then assert thecontentDocument
property of the iframe to ensure that it loaded successfully. The rest of the test is explained in the comment above it. Hope this helps!It appears to me that no amount of waiting for the frame to load works for this page. The payment options never appear.
BUT, if you open the address in a new window the logos and payment buttons do appear.
This suggests you could try testing it in a new window – the approach is a little experimental but working.
See Unable to load a specific URL with Cypress for reference.
Here is a working test.
It uses the
cy.openWindow()
developed by Gleb Bahmutov here Cypress using child window with some adjustments.Also, some setting needed in
cypress.config.js