samedi 5 décembre 2020

How to select last button in a document on Cypress?

This code always removes the first item, meaning it clicks the first button it finds with this className. I need to delete the last one. What is wrong with my code?

it('Course can be deleted', function () {
            cy.get('.buttonDelete').last().click()
            cy.contains('Course was removed successfully')
            cy.should('not.contain', 'e2eTestCourse')
        })

Aucun commentaire:

Enregistrer un commentaire