Is it possible to wait for two or more elements to be visible?

Hi Community,

I want to take a screenshot of a page until two or more elements are visible (they are twitter feeds). Is there any way to do that?

I have tried using the smart wait functionality, but it doesn’t seems to work, the screenshot is took and the twitter feeds are not visible.

Thanks in advance,
Ruben B

1 Like

You want to keep taking pictures of page until two elements are visible. You might be able to try something like below:

boolean isDone = false
int counter = 0
while (!isDone) {
    if (!WebUI.verifyElementVisible(findTestObject('Element1')) && !WebUI.verifyElementVisible(findTestObject('Element2'))) {
        WebUI.takeFullPageScreenshot(gReportPathway + "TwoElement${counter}.png")
        counter++
    } else {
        isDone = true
    }   
}

Edit: if one of the elements become visible, this will stop taking “pictures”, so you might need to improve the statement some until you get what you want completely.

if ...
else if ...
else if ...
else ...
1 Like

Please look doc [WebUI] Verify Element Visible | Katalon Docs

Thanks all!