0
it('Access URL', () => {
  cy.visit('URL')
  cy.wait(5000)
  cy.get('.login-btn').click()
  })

URL is working but login click is not working. (uncaught exception)TypeError: $(...).datepicker is not a function --- is displayed

Trying to access url and trying to click the Login link in the website.

1

2 Answers 2

1

If it takes the page more then 5 seconds to load cypress would never find the button in your code. If you can give the button an id it would be able to find it, but if you can't you can try to add a long timeout to the button and when the button appear on the page it will click it, for example.

`cy.get('.login-btn', { timeout: 30000 }).click()`
Sign up to request clarification or add additional context in comments.

1 Comment

(uncaught exception)TypeError: $(...).datepicker is not a function (xhr)POST 200 /jm-ajax/get_listings/ TypeError The following error originated from your application code, not from Cypress. > $(...).datepicker is not a function When Cypress detects uncaught errors originating from your application it will automatically fail the current test. The above error is getting displayed when tried the code cy.get('.login-btn',{timeout:30000}).click()
0

By the looks of your comment, you have an uncaught exception in your application. That’s an indication you or a dev needs to fix something in the app. Cypress is just trying to tell you.

If you want to ignore the error, you can add this to your test

it('Access URL', () => {
  cy.once('uncaught:exception', () => false);
  cy.visit('URL')
  cy.wait(5000)
  cy.get('.login-btn').click()
})

If you want to ignore uncaught exceptions in ALL tests you can add this to your support file. (I do NOT recommend this, I recommend fixing your application to find out why it’s throwing an exception in the first place)

// support/index.js
Cypress.on('uncaught:exception', () => false);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.