mercredi 28 novembre 2018

.then() vs aysnc and await protractor

I am new to protractor and have been reading up on promise chaining using the .then() function.

For example

 this.getContent = function(content) {
    return element.all(by.repeater('item in list')).filter(function(elem) {
        return elem.getText().then(function(text) {
            return text;
        });
    }).first();
};

Which works fine to get the text i'm looking for. However, how can i restructure this to use async and await instead of the the .then() function?

Every time I try i just get a element explorer and no text.

Thanks in Advance

Aucun commentaire:

Enregistrer un commentaire