iFrame interaction issues
See original GitHub issueCurrent behavior:
I’m trying to interact with cross-origin iframe present on the website. In my test, when i don’t have “chromeWebSecurity”: false parameter set, all steps before the iframe interaction are passing and the interaction is not working (currently known issue).
But when i set the “chromeWebSecurity”: false parameter in cypress.json my test start to fail on earlier steps like asserts, getting elements etc. and i can’t even get to iframe interaction part.
As i’ve found in console, i’ve got error, like this:
Refused to display ‘https://myurl.com/some_id’ in a frame because it set ‘X-Frame-Options’ to ‘sameorigin’
When the option isn’t added in cypress.json i don’t have such issues and all previous steps are working.
Desired behavior:
I can interact with iFrame after adding “chromeWebSecurity”: false (as suggested in discussions about iframes)
Steps to reproduce:
Add “chromeWebSecurity”: false to cypress.json and try to proceed to iframe and interact with it. check the same without setting this parameter to false
Versions
Cypress 2.1.0, Chrome66, Electron59
Issue Analytics
- State:
- Created 5 years ago
- Reactions:7
- Comments:28 (5 by maintainers)
Top GitHub Comments
@oiurch - I have found a way to bypass the iframe issues. Works with the latest Chrome verision 67.0.3396.62
In my
plugins/index.js
file I have added the following:You can download the extension from here. Just copy-paste this and unpack it to your extension folder. You can find more details about the disabled flags here. Good luck
I got a nice error message in cypress about this anyway, but I though I would add a comment to hopefully help some avoid confusion. There is some syntax that is out of date in all the previous code examples. The changes should all be updated in this document: https://docs.cypress.io/api/plugins/browser-launch-api.html#Modify-browser-launch-arguments-preferences-and-extensions and here https://docs.cypress.io/guides/references/migration-guide.html#Plugin-Event-before-browser-launch
But for this specific extension, this has been working for me (I don’t think you have to provide the path to the extension, as it talks about in the docs, if you pack and unpack it in the default folder for extensions for cypress?):