[SOLVED] The following error originated from your application code, not from Cypress

Issue

i tried to test this simple code

       type Url = string
       it('loads examples', () => {
      const url: Url = 'https://www.ebay.com/'
       cy.visit(url)
       cy.get('input[type="text"]').type('book')
        cy.get('#gh-btn').click();

        })

then I faced this error

enter image description here

how can I solve it

Solution

Try adding this in support/index.js:

import './commands'
Cypress.on('uncaught:exception', (err, runnable) => {
  // returning false here prevents Cypress from failing the test
  return false
})

This should avoid the uncaught:exception in the click() method.

Answered By – leen M

Answer Checked By – Marilyn (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *