user2201789
user2201789

Reputation: 1203

cypress wait element then perform next action

i have a page which loads after 6secs before buttons appeared.

I want the script does not fail, wait for the button then perform clicks.

the cypress documentation stated "wait for an aliased resource" ,

i am not sure what is this and how to integrate to current script:

cy.contains('Button A').click()

Upvotes: 1

Views: 563

Answers (1)

Alapan Das
Alapan Das

Reputation: 18634

You can add a timeout for 6 seconds and more.

cy.contains('Button A',{ timeout: 6000 }).should('be.visible').click()

Upvotes: 1

Related Questions