Actuellement, j'ai une page qu'il y a un élément qui est affiché au hasard. Pour cela, j'ai créé une fonction de condition:Si l'élément n'est pas présent, j'obtiens erreur même en ajoutant la fonction conditionnelle
this.checkDropdownPresent = function (dropdownLocator, chooseOption) {
dropdownLocator.isPresent().then(function(element) {
if (element) {
let select = dropdownLocator;
select.element(by.cssContainingText('option', chooseOption)).click();
}
});
};
Lorsque l'élément est affiché dans l'écran, qui fonctionne bien et protractor interagir avec lui, mais quand l'élément ne figure pas dans l'écran, je reçois la message:
Failed: element not visible: Element is not currently visible and may not be manipulated
Un conseil pour m'aider avec ça?
Il semble que vous ayez besoin de vérifier si l'élément est visible, et pas seulement s'il existe. – Barmar
Connexes: https://stackoverflow.com/questions/36544589/element-is-not-currently-visible-and-so-may-not-be-interact-with-when-clicking – Barmar