

Tip: we will be using data-cy attribute to find the iframe following our Best Practices for selecting elements guide. Let's take a static HTML page and embed an iframe. Note: you can find the source code for this blog post in the recipe "Working with iframes" located in the repository cypress-example-recipes. In this blog post I will show how to interact with DOM elements inside an iframe (even if the iframe is served from another domain), how to spy on window.fetch requests that the iframe makes, and even how to stub XHR requests from the iframe. If your web application uses iframes, then working with elements in those iframes requires your own custom code. iframe when it sees a Cypress command (re-enactment) Mostly because all built-in cy DOM traversal commands do hard stop the moment they hit #document node inside the iframe.
