Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

405
Views
How to resolve - Cypress detected a cross origin error?

So i am using cypress to log into google and create a google form. I have gotten through the login, but now that I want to select create new form, I am seeing cross origin errors which seem to be blocking such actions. Can anyone help me out here? Heres my code. Its the click on #1f that is not working see error

'''

 describe('Test', function () {
  it('logs into google', function () {
    Cypress.on('uncaught:exception', (err, runnable) => {
        return false
        })
    cy.visit('http://docs.google.com/forms/u/0')

    cy.xpath("//input[@type='email']").type("userAlktest@gmail.com");
    cy.xpath("//span[contains(text(),'Siguiente')]").click();
    cy.wait(5000);
    cy.xpath("//input[@type='password']").type("1Testagain");
    cy.xpath("//span[contains(text(),'Siguiente')]").click();
    cy.wait(5000);
    ///cy.xpath("//span[contains(text(),'Probar otra manera')]").click();
  ///  cy.wait(5000) 
  ///     cy.xpath("//span[contains(text(),'Confirmar')]").click();
   /// cy.wait(5000)

   //cy.xpath("//span[contains(text(),'Untitled form')]").click();
   //cy.wait(5000)

   cy.get('#:1f').click();
   cy.wait(5000);

'''

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This is a cypress tradeoff and you can read about it from the cypress docs. In a nutshell, if you want to access two different URLs in one test you cannot. For this scenario, you have to write two tests where each URL is accessed. For e.g.

NOT OK ❌

it('navigates', () => {
  cy.visit('https://apple.com')
  cy.visit('https://google.com') // this will error
})

OK ✅

it('navigates', () => {
  cy.visit('https://apple.com')
})

// split visiting different origin in another test
it('navigates to new origin', () => {
  cy.visit('https://google.com') // yup all good
})
about 4 years ago · Juan Pablo Isaza Report

0

Maybe it would help it would help more if more clarity was provided on what the reason for creating a Google form.

Back to the question, the original domain your test is bounded is https://google.com. I imagine removing the describe() block and having two it() with no describe() could help you out.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!