How do I register an item with a protractor?
I am trying to find an element using a protractor, but I cannot find it. To debug, I would like to look at the item I found and see what it is. I have a code like this:
myElement.all(by.cssContainingText('.name', 'value')).then(function (elems) {
console.log(elems.length); <--- this line logs "2"
console.log(elems[1]); <--- this line logs "{ ptor_: ...."
elems[1].getInnerHtml().then(function(html){
console.log(html); <--- never gets here
}); });
How can I find out which elements the all () method found?
+3
source to share
1 answer
Not sure if this is the best / most concise way, but you should use map
to loop through the elements and use getOuterHtml()
for every HTML access
myElement.all(by.cssContainingText('.name', 'value')).map(function(el) {
return el.getOuterHtml();
}).then(function(html) {
console.log(html);
});
+3
source to share