79205808

Date: 2024-11-20 04:33:17
Score: 1
Natty:
Report link

To find the row that has "Covid" in the second column, use td:nth-child(2):contains("Covid").

To illustrate, here's a similar test on the Material Angular examples page.

enter image description here

it('get last column of a row with particular value in Name column', () => {

  cy.visit('https://material.angular.io/components/table/examples');

  cy.get('table-basic-example').within(() => {

    cy.get('tr:has( td:nth-child(2):contains("Lithium") )')
      .find('td:last')
      .should('have.text', ' Li ')
  })
})

enter image description here

You have more than one Category with "Covid", so I recommend adding :first as well,

cy.get('tr:has( td:nth-child(2):contains("Covid"):first )')
  .find('td:last')
  .click()
Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Chris.C.Gauthier