0

I am trying to test the login dialogue of my application. There is a wait until an element with class name "LoginDialog" is added to the DOM. However, the dialog doesn't appear right away anymore on the UI though it is still added to the DOM right away. I need to determine if it is visible as well.

I decided to first pollUntil the element is added then check if the element is dipslayed using isdiplayed but i still keep getting element no visible error

.then(pollUntil('return document.getElementsByClassName("LoginDialog", 8000)'))
.findAllByXpath("//div[contains(@class, \'LoginDialog\')]")
     .isDisplayed()
     .then(function(bool) {
            debugger;
            if (!bool[0]) {
                  this.then(pollUntil('return document.getElementsByClassName("LoginDialog", 8000)'))
                  //not sure about this step too. i need to wait until the element is diplayed on the UI
            }
      }).end()
8785krs
  • 101
  • 1
  • 1
  • 9

1 Answers1

2

Leadfoot has a set of findDisplayed methods for just this purpose. These methods will find the first displayed element that matches the query. Like regular find, they'll wait up to the current find timeout for a matching element to appear.

this.remote
    .findDisplayedByClassName('LoginDialog')
jason0x43
  • 3,363
  • 1
  • 16
  • 15