Search code examples
seleniumnoraui

How to wait until a popin is displayed?


I'm looking for a wait until function that can wait until a popin (present in the dom but not initialized) is displayed. The loading of this popin could take few seconds. Thanks by advance for all your tips !


Solution

  • To answer to your question, if you use NoraUi, we can see 2 main behavior:

    • Your popup opens in a new window. In this case You can use the following method:

    You wait until the popup opens and then you can switch to it and check your element:

    String newWindowHandle = Context.waitUntil(WindowManager.newWindowOpens(getDriver().getWindowHandles()));
    
    • Your popup is a modal (present in the DOM but not visible). In this case You can use the following method:

    You wait until your element become visible:

    Context.waitUntil(ExpectedConditions.visibilityOfElementLocated(locator));
    

    Regards