79191875

Date: 2024-11-15 10:05:22
Score: 1
Natty:
Report link

To find the row number of a particular text value, use the jQuery .index() method.

Search for a given element from among the matched elements

Assuming it's in the 4th row,

cy.contains('tr', ':contains(text-to-find)')
  .invoke('index')        // returns position among siblings (other <tr>)
  .should('eq', 5)
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Brandstetter