Skip to content Skip to sidebar Skip to footer

Cloning Element Finders

While researching available ElementFinder and ElementArrayFinder methods, I've noticed that there is a clone() method which is briefly documented: Create a shallow copy of Element

Solution 1:

Clone was introduced here: https://github.com/angular/protractor/issues/1303. And honestly now I think about it, it was a mistake to introduce it, as it offers no practical values.

Originally, there was fear that subsequent chains of elementFinders would affect previous ones:

var outerElement = element(by.abc...).all(by.def...).first().element(by.ghi...);
var outerText = outerElement.getText();
var innerElement = innerElement.element(by.xyz...);
// Now that I chained more things onto outerElement, is the original outerElement still behaving the same as before? (i.e. is outerText the same as outerElement.getText() still)

Post a Comment for "Cloning Element Finders"