//1st Selector
cy.get('div.d-flex.justify-content-between.undefined > button.button.button-filled').contains('Yes, delete user');
//2nd selector
cy.get('div.modal.fade.show > div > div > div > div:nth-child(3) > button.button.button-filled').contains('Delete User');
So i got 2 selector, can you help me to make if/else condition, if the 1st condition not working then run the 2nd selector?
thank you!
2
Answers
You can compose selectors with a comma between to perform either/or logic.
For example (just using button caption because it seems unique)
If you want you can add all those other selectors, but it looks a bit over-done to me.
If you page has finished loading, you can use the following code to click one button or the other