I have a table with 3 rows of data and 3 delete buttons. I want to delete all rows of data, so I'm trying to write a method in my page object to do this ... this should be fast, but I can't get it to work. I try it like this:
this.rows = element.all(by.repeater('row in rows')); this.deleteAllFriends = function() { this.rows.each(function(row) { row.$('i.icon-trash').click(); }) };
But this causes an error:
Error: Index out of bound. Trying to access index:2, but locator: by.repeater("row in rows") only has 1 elements
Thus, it is obvious that the protractor pointer expects the next one; it no longer exists because it has been deleted. How can I get around this?
This also does not work and produces the same error:
this.deleteButtons = $$('i.icon-trash'); this.deleteAllFriends = function() { this.deleteButtons.each(function(button) { button.click(); }); };
This also does not work ...
this.deleteAllFriends = function() { while(this.deleteButton.isDisplayed()) { this.deleteButton.click(); } };
Brine source share