Khaled Mustafa
Khaled Mustafa

Reputation: 23

How to click with cypress

Click on link using Cypress

I'm trying to click on the 181 Fastighet using cypress as you see in the picture. writing like this cy.get('.col-lg-11 col-md-11 text-left text-nowrap text-truncate ').click(); but i get an error Timed out retrying after 4000ms: Expected to find element: .col-lg-11 col-md-11 text-left text-nowrap text-truncate , but never found it.

The test can not find the div where it should click on. I tried many different ways but it does not work! Any Ideas ??

Upvotes: 0

Views: 296

Answers (1)

Abdullah Sohail Yaqoob
Abdullah Sohail Yaqoob

Reputation: 361

Try this simple approach:

cy.contains("181 Fastighet").should('be.visible').click()

Happy Testing!

@mustafa for your 2nd question related to "Press Enter":

cy.get('#password').type('password123{enter}')

Upvotes: 2

Related Questions