recherche un élément dans un répéteur contenant un texte spécifique à l'aide de rapporteur

Comment pourrais-je recherche un élément à partir d'un répéteur contenant un texte spécifique ?

J'ai essayé des choses comme ça :

element(by.repeater('item in array')).all(by.cssContainingText('.xyz','my item title')); //only gets the first element

Je pourrais chercher par moi-même à l'aide de .then après element.all mais je me demandais si il existe quelque chose de plus simple comme cssContainingText mais pour les redoublants :

element(by.repeaterContainingText('item in array','my item title'))

ou un élément de chaînage comme ça :

element.all(by.repeater('item in array')).element(by.cssContainingText('.xyz','my item title'));

Une solution avec filtre (mais très lent)

element.all(by.repeater('item in array')).filter(function(elem){
    return elem.getText().then(function(text){
        return text.indexOf('my item title') > -1;
    });
}).then(function(filteredElements) {
    return filteredElements[0];
})
  • veuillez envisager d'accepter une réponse.
InformationsquelleAutor sylvain | 2014-07-30