I'm using Protractor and I have a situation where I have html game and in the game three options that are available based on the play:
- option 1
- option 2
- option 3
So how should I write if clause to check whether option 1 is displayed or option 2 or option 3, so that I can make further interactions based on displayed option?
Currently I have the following written for option 1:
// wait for option 1 pop up not to be visible
browser.wait(EC.invisibilityOf(game.option1PopUp), 60000).then(function(isNotVisible) {
//if (isNotPresent) {
if (isNotVisible) {
// verify element is not visible
isNotVisible == true;
console.log("\tNo option 1 is displayed.\n");
} else {
// verify element is visible
isNotVisible == false;
console.log("\tOption 1 is displayed.\n");
// wait for button to be clickable
browser.wait(EC.elementToBeClickable(game.option1OkButton), 15000).then(function() {
// click on button
game.option1OkButton.click();
};
});
How can I check if option 1 is not displayed, but option 2 is or perhaps option 3? Only one option can be displayed at once.
Aucun commentaire:
Enregistrer un commentaire