{"id":16763410,"url":"https://github.com/mkubdev/cypress-nested-iframe","last_synced_at":"2025-06-29T13:37:27.580Z","repository":{"id":59382199,"uuid":"342294168","full_name":"mkubdev/cypress-nested-iframe","owner":"mkubdev","description":"⚙️ An example of how to use Cypress to target nested elements within nested iframes","archived":false,"fork":false,"pushed_at":"2021-02-25T15:57:51.000Z","size":65,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T10:30:52.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkubdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-25T15:43:19.000Z","updated_at":"2023-04-13T14:04:02.000Z","dependencies_parsed_at":"2022-09-16T10:01:43.757Z","dependency_job_id":null,"html_url":"https://github.com/mkubdev/cypress-nested-iframe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mkubdev/cypress-nested-iframe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkubdev%2Fcypress-nested-iframe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkubdev%2Fcypress-nested-iframe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkubdev%2Fcypress-nested-iframe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkubdev%2Fcypress-nested-iframe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkubdev","download_url":"https://codeload.github.com/mkubdev/cypress-nested-iframe/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkubdev%2Fcypress-nested-iframe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262601195,"owners_count":23335209,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T05:06:28.440Z","updated_at":"2025-06-29T13:37:27.537Z","avatar_url":"https://github.com/mkubdev.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Using Cypress with iframes\n ⚙️ An example of how to use [Cypress](https://www.cypress.io/) to target nested elements within iframes.\n\nWith limited iframe support from Cypress [[Issue #136](https://github.com/cypress-io/cypress/issues/136)], the following workaround in this repo allowed to target elements and interact with iframes during tests.\n\n### Explanation\n\nThe solution is to create an iframe command that returns a promise upon iframe loading completion. These commands, aliased as `iframe()`, can be chained together to deal with nested iframes.\n\n```js\n// support/commands.js\n\nCypress.Commands.add('iframe', { prevSubject: 'element' }, $iframe =\u003e {\n  return new Cypress.Promise(resolve =\u003e {\n      $iframe.ready(function() {\n        resolve($iframe.contents().find('body'));\n      });\n  });\n});\n```\n\nHere is an example of usage:\n\n```js\n// One iframe\ncy.get(\"#iframe\").iframe().find(\"#target\").type(\"HELLO WORLD\");\n\n// Nested iframes\ncy.get(\"#firstFrame\").iframe().find(\"#secondFrame\").iframe().find('#target').type('HELLO WORLD');\n```\n\n### Links\n\n[Cypress.io](https://www.cypress.io/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkubdev%2Fcypress-nested-iframe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkubdev%2Fcypress-nested-iframe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkubdev%2Fcypress-nested-iframe/lists"}