angularjs - How to get the text of all elements in protractor -



angularjs - How to get the text of all elements in protractor -

i want fetch li texts of suggestions after entering in google search bar "webdriver". have wrote code this:

this.getelements = function(){ element.all(by.css('ul.sbsb_b')).then(function(text){ for(var i=0; < text.length;i++) { console.log(text[i].gettext()); } }); };

on execution m getting like:

{ ptor_: { controlflow: [function], schedule: [function], getsession: [function], getcapabilities: [function], quit: [function],

instead of text values of suggestions.

there set of javascript array-like functions in protractor allows filter() or map() result of async promise. illustration if original "element.all(by.css('something'))" homecoming list of elementfinders, map() allows transform array of gettext()s, in resolved state array of strings. can utilize want.

element.all(by.css('something')).map(function(elm) { homecoming elm.gettext(); }).then(function(texts) { texts.foreach(...); });

angularjs protractor

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -