Currently, I am utilizing Webdriverio, Selenium, and JavaScript for my project.
Within my frontend design, there are three div elements, each housing a table with the same classname (field_table). These divs are identified by the ids 0, 1, and 2, all sharing the classname receiver_field.
Each table within these divs features a button with an identical classname (delete-button).
This setup is due to the automated generation of these tables.
While performing testing in Webdriverio Selenium test, I face a challenge when trying to click one of the three buttons to delete an entry. The issue arises from all buttons having the same classnames.
I attempted to navigate through their ids but encountered difficulties in making it work.
it('should be possible to delete on button click', function () {
// Get receiver fields
var fields = browser.elements('.form-control-list');
expect(fields.value.length).to.equal(6);
// Get only one table
// Obtain the button within that specific table
// Click on the button
//expect(fields.value.length).to.equal(4);
});
Does anyone have any suggestions or solutions to this predicament?