0
votes

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 ??

1
Is the text 181 Fastighet unique in that web page ?Alapan Das
@AlapanDas How can i know that ? It seems like its click on the text and not on the linkKhaled Mustafa
Can you try- cy.contains('181 Fastighets', {matchCase: false}).click()Alapan Das
Thank you! I needed to make a lite bit edits so let it work! But a big thank u for u :)Khaled Mustafa
Please post the final answer here, so that it will help others as well.Alapan Das

1 Answers

2
votes

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}')