Reputation: 377
I need to click on the edit button of a certain text in a table.
For example the table row has the text abc i need to click on the icon-pencil of this particular row text
I have tried:
cy.contains('td', 'abc')
.scrollIntoView()
.siblings()
cy.get('td div').within(() => {
cy.get('.actions').and('have.class','icon-pencil').click()
})
but it is not finding the class actions
This is the html:
Please let me know what is wrong. thank you
Upvotes: 0
Views: 124
Reputation: 18624
You have to do something like this:
cy.contains('td', 'abc')
.parent('tr')
.within(() => {
cy.get('i.icon-pencil').click()
})
Upvotes: 1