Once worked with Cypress.io before but completely forgotten how to work around that cross origin error of theirs. Baically this code gives me error:
context('searching example',() => {
beforeEach('open google',() => {
// Cypress.config('chromeWebSecurity', true);
cy.visit('https://google.com');
})
describe('google test example', ()=>{
it('search for death star',() => {
cy.get("button[role='link']").click()
})
})
})
The error I'm getting is:
CypressError
Cypress detected a cross origin error happened on page load:
> Blocked a frame with origin "https://www.google.com" from accessing a cross-origin frame.
Before the page load, you were bound to the origin policy:
> https://google.com
A cross origin error happens when your application navigates to a new URL which does not match the origin policy above.
A new URL does not match the origin policy if the 'protocol', 'port' (if specified), and/or 'host' (unless of the same superdomain) are different.
Cypress does not allow you to navigate to a different origin URL within a single test.
You may need to restructure some of your test code to avoid this problem.
Alternatively you can also disable Chrome Web Security in Chromium-based browsers which will turn off this restriction by setting { chromeWebSecurity: false } in cypress.json.Learn more
I've tried adding this to cypress.json to no avail
{"chromeWebSecurity": false}