javascript - While loops in protractor -
i have started using protractor e2e tests. have combobox lists events match user types in - list empty if no such events found.
what enter 3 random characters, , if combobox list empty, clear combobox , retry 3 random characters. should repeated until non-empty list found.
i have tried using simple while loop this, asynchronous nature of webdriverjs means become stuck in infinite loop. possible somehow wait inside loop combobox populated? or there other, cleaner solution problem?
code:
var query = element(by.model('searchstr')); query.clear(); var letters = generaterandomletters(); console.log(letters); query.sendkeys(letters); var eventlist = element.all(by.repeater('result in results')); eventlist.count().then(function(count) { if(count) { //test continues here } });
declare function calls recursively until condition met. should trick.
Comments
Post a Comment