Webpage doesn't load in Cypress where as Page loads perfectly in chrome browser

2.4k Views Asked by At

Below is the dev console in cypress

enter image description here

I have tried adding below config is Cypress.json

{ "modifyObstructiveCode" : false }

but this causes Cypress runner to not find my test at all

This is my Cypress code :

/// <reference types="Cypress" />

describe("Service Now TEST login", () => {
    it("Login TEST", () => {
        cy.visit("https://hptest.service-now.com/login.do")
        cy.wait(2000)
        cy.get(".form-control", {
            timeout: 10000
        }).should("be.visible").then(() => {
            cy.get("#user_name").type("");
            cy.get("#user_password").type("");
            cy.get("#sysverb_login").click();
        });
    })
})

Please help me here.

1

There are 1 best solutions below

4
On

I can see in your test runner logs that there is a exception generated, you can catch the exception using:

Cypress.on('uncaught:exception', (err, runnable) => {
  return false
})

So your code should look like:

describe('Service Now TEST login', () => {
  it('Login TEST', () => {
    cy.visit('https://hptest.service-now.com/login.do')
    //Catch Exception
    Cypress.on('uncaught:exception', (err, runnable) => {
      return false
    })
    cy.wait(2000)
    cy.get('.form-control', {
      timeout: 10000,
    })
      .should('be.visible')
      .then(() => {
        cy.get('#user_name').type('')
        cy.get('#user_password').type('')
        cy.get('#sysverb_login').click()
      })
  })
})