dictionary - How to Apply a map function to each element within the ElementArray Finder -


i trying loop, compare based on text , if matched click on element.

i stumbled on below post helpful

passing protractor elementfinder deferred.fulfill() results in promise containing null value

based on answer provided in above post, implemented

  element.all(by.css('.classname')).map(function (elm, index) {          return {              elm: elm,             text: elm.gettext(),             index: index          };     }).then(function (list) {          (var = 0; < list.length; i++) {             if (list[i].text === 'ds_emulator') {                  return list[i].elm;             }         }         throw new error('text not found');     }).then(function (elm) {            elm.click();                     });      }); 

this made application exit out without error. happening due elm: elm in map.

if modify code below, application works fine.

 element.all(by.css('.classname')).map(function (elm, index) {          return {            // elm: elm,             text: elm.gettext(),             index: index          };     }).then(function (list) {          (var = 0; < list.length; i++) {             if (list[i].text === 'ds_emulator') {                  return list[i].index;                //  return list[i].elm;             }         }         throw new error('text not found');         }).then(function (elm) {            //  elm.click();              element.all(by.css('.classname')).then(function (items) {                  items[elm].click();              });      }); 

please me understand going wrong.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -