Complete the code to get the iframe body for interaction.
cy.get('iframe').its('0.contentDocument.body').should('[1]', 'not.be.empty').then(cy.wrap)
We use should('exist') to ensure the iframe's body is present before interacting.
Complete the code to click a button inside the iframe.
cy.get('iframe').its('0.contentDocument.body').should('exist').then(cy.wrap).find('[1]').click()
The selector #submitBtn targets the button by its unique ID inside the iframe.
Fix the error in the code to correctly access iframe contents.
cy.get('iframe').[1]('0.contentDocument.body').should('exist').then(cy.wrap)
The its command accesses a property of the iframe element, here 0.contentDocument.body.
Fill both blanks to wait for iframe load and then interact with its body.
cy.get('iframe').[1]('load').then(() => { cy.get('iframe').its('[2]').should('exist').then(cy.wrap) })
We use trigger('load') to wait for the iframe to load, then access 0.contentDocument.body to interact.
Fill all three blanks to create a custom command to get iframe body.
Cypress.Commands.add('getIframeBody', () => { return cy.get('iframe').[1]('0.contentDocument.body').should('[2]', 'not.be.empty').then(cy.[3]) })
This custom command uses its to get the iframe body, asserts it exists and is not empty, then wraps it for Cypress chaining.