Cypress · Middle · Question 17 of 77
How do you interact with content inside an iframe in Cypress?
- 1Iframes are pierced automatically by
cy.get - 2Get the iframe's body and wrap it, or use a plugin
- 3Use
cy.frame('#id'), a built-in command
Show the answer
Correct answer: Get the iframe's body and wrap it, or use a plugin
Explanation
A common helper gets iframe.contentDocument.body, waits for it to be non-empty, then uses cy.wrap() to query inside.