Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The following error originated from your application code, not from Cypress

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

like image 392
leen M Avatar asked Sep 11 '25 17:09

leen M


1 Answers

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.

like image 105
leen M Avatar answered Sep 13 '25 05:09

leen M