Using cypress filters to pick the text of an element

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
evpo_4814691
Level 1
Level 1

Hi everyone,

There's an example of using cypress filters to pick a particular element -

<ul>

  <li>Home</li>

  <li class="active">About</li>

  <li>Services</li>

  <li>Pricing</li>

  <li>Contact</li>

</ul>

// yields <li>About</li>
cy.get('ul').find('>li').filter('.active')

What can I do if I need to picket the text 'About' instead of the class '.active'?

Thank you.

0 Likes
1 Solution
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

This question pertains to cypress.io which is a front-end testing tool. You are in the wrong "Cypress" community, you might want to put your query here: cypress-io/cypress - Gitter

Regards,

Dheeraj

View solution in original post

0 Likes
2 Replies
VenkataD_41
Moderator
Moderator
Moderator
750 replies posted 500 replies posted 250 solutions authored

Hi,

Can you please elaborate more on your query?

What is your application? What kind of device are you looking for your application?

Thanks

Ganesh

0 Likes
DheerajK_81
Moderator
Moderator
Moderator
First comment on KBA First comment on blog 5 questions asked

This question pertains to cypress.io which is a front-end testing tool. You are in the wrong "Cypress" community, you might want to put your query here: cypress-io/cypress - Gitter

Regards,

Dheeraj

0 Likes