I want to capture inner Iframe and click element inside the inner iframe by using xpath. I tried so many ways to handle nested iframes in cypress. But I didn't find a proper way. Can anyone please tell me how to handle nested iframes and click element inside the inner iframe.
cy.iframe('iframe[id="app-iframe"]').then(($iframe) => {
// Select the inner iframe inside the outer iframe
const $innerIframe = $iframe.contents().find('iframe[class="k-content"]');
// Select the element inside the inner iframe where you want to type
cy.wrap($innerIframe)
.cy.xpath('//body[@contenteditable="true"]', {timeout: 10000})
.click().type('Hello World');
});
I used the above code but it didn't work.