Way you can call your JUnit function from main
Here is some help on how to: How do I run JUnit tests from inside my Java application?
Or you can simply add Thread.sleep(millisecond)
try {
Thread.sleep(100);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
It must work in Java (Eclipse).
But you can also use (I think it is better for testing):
FluentWait fluentWait = new FluentWait<>(webDriver) {
.withTimeout(30, TimeUnit.SECONDS)
.pollingEvery(200, TimeUnit.MILLISECONDS);
.ignoring(NoSuchElementException.class);
}
WebElement element = (new WebDriverWait(driver, 10))
.until(ExpectedConditions.elementToBeClickable(By.id("someid")));
Source: How can make it wait until an element is present in Selenium?