I've a table that includes multiple rows and columns.
I want to trigger the following scenario:
- Get the row that has any of its columns match specific keywords.
- Click on a button inside this row.
Here is my table structure:
And here is my code snippet
clickOnDeleteIcon(email: string) {
cy.get('tbody.MuiTableBody-root tr td', { timeout: 20000})
.filter(`:contains(${email})`)
.parentsUntil('tbody.MuiTableBody-root tr')
.find('button[title = "Delete"]')
.click()
}
I also tried
clickOnDeleteIcon(email: string) {
cy.contains('tbody.MuiTableBody-root tr td', email).parent('tr')
.find('button[title = "Delete"]')
.click()
}
But, I'm getting timeout in filter
Timed out retrying after 10000ms: Expected to find element: :contains(Julie_Williamson88@gmail.com), but never found it. Queried from element: [ <td.MuiTableCell-root.MuiTableCell-body.MuiTableCell-paddingNone>, 1535 more... ]