Nightwatch / Selenium and Promises -
is possible wait webdriver/selenium input on javascript side? i've got following code nightwatch.js
getprogrammlinks: function() { let self = this; // well. return new promise(function(resolve, reject) { var links = []; self.api.elements('css selector', 'a[role=button]', function(elements) { if (elements.state == 'success') { (itemid in elements.value) { self.api.elementidattribute(itemid, 'href', function(item) { if (item.state == 'success') { if (item.value.includes('programm')) { links.push(item.value); } } else { reject(item); } }) } resolve(links); // after items have been processed } else { reject(elements); } }); }); }
anyhow never links
when using getprogrammlinks().then(function(links) {});
, seems stop after first iteration of itemid (it pushes links
once (or runs if statement). appreciated
Comments
Post a Comment