IssueRaiser

Iframe support

**Updated Feb 9, 2021 - see note below or https://github.com/cypress-io/cypress/issues/136#issuecomment-773765339** Currently the Test Runner does not support selecting or accessing elements from within an iframe. ## What users want Users of Cypress need to access elements in an `<iframe>` and additionally access an API to "switch into" and switch back out of different iframes. Currently the Test Runner thinks the element has been detached from the DOM (because its `parent` document is not the expected one). ## What we need to do - Add new `cy` commands to switch into iframes and then also switch back to the "main" frame. - Cypress must inject itself into iframes so things like XHR's work just like the main frame. This will ideally use something like `Mutation Observers` to be notified when new iframes are being pushed into the DOM. - [ ] Add API to navigate between frames - [ ] Update the Driver to take into account element document references to known frames ## Things to consider - How will we handle snapshotting? Currently we don't take snapshots for anything inside of an `<iframe>`. - How will we handle cross origin frames? It's possible to enable these with `{ chromeWebSecurity: false }` (Chromium-based browsers only). - How will we show context switching in the Command Log? It should probably look / be colored differently than the 'normal' main commands ## Examples of how we could do this ```js // switch to an iframe subject cy .get('#iframe-foo').switchToIf

Posted by brian-mann on May 11, 2016, 1:19 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.5,000 issues0 comments

support (Software)

Iframe support

brian-mannMay 11, 2016, 1:19 PM

**Updated Feb 9, 2021 - see note below or https://github.com/cypress-io/cypress/issues/136#issuecomment-773765339** Currently the Test Runner does not support selecting or accessing elements from within an iframe. ## What users want Users of Cypress need to access elements in an `<iframe>` and additionally access an API to "switch into" and switch back out of different iframes. Currently the Test Runner thinks the element has been detached from the DOM (because its `parent` document is not the expected one). ## What we need to do - Add new `cy` commands to switch into iframes and then also switch back to the "main" frame. - Cypress must inject itself into iframes so things like XHR's work just like the main frame. This will ideally use something like `Mutation Observers` to be notified when new iframes are being pushed into the DOM. - [ ] Add API to navigate between frames - [ ] Update the Driver to take into account element document references to known frames ## Things to consider - How will we handle snapshotting? Currently we don't take snapshots for anything inside of an `<iframe>`. - How will we handle cross origin frames? It's possible to enable these with `{ chromeWebSecurity: false }` (Chromium-based browsers only). - How will we show context switching in the Command Log? It should probably look / be colored differently than the 'normal' main commands ## Examples of how we could do this ```js // switch to an iframe subject cy .get('#iframe-foo').switchToIf

Comments (0)

No comments yet. Start the discussion.

Comment on this issue