Letícia Barbosa
Letícia Barbosa

Reputation: 41

How to wait until element is visible using TestFX?

I'm trying to use waitUntil() method from TestFX to wait until a dialog appears on the screen. I found the example provided by the Wiki, but it doesn't seem to work with me. Can anyone help me to figure this out?

Upvotes: 2

Views: 2944

Answers (2)

Hemã Vidal
Hemã Vidal

Reputation: 1872

You can use this method also:

import org.testfx.util.WaitForAsyncUtils;

WaitForAsyncUtils.waitFor(10, TimeUnit.SECONDS, new Callable<Boolean>() {
    @Override
    public Boolean call() throws Exception {
        return find(".dialog-pane").isVisible();
    }
});

With this solution you can also define the TimeUnit.

Upvotes: 3

Let&#237;cia Barbosa
Let&#237;cia Barbosa

Reputation: 41

I managed to resolve this by using:

import org.hamcrest.Matchers;
import org.loadui.testfx.controls.impl.VisibleNodesMatcher;

waitUntil(".dialog-pane", Matchers.is(VisibleNodesMatcher.visible()));

Upvotes: 2

Related Questions