I have one verification button which have some delay after I click on it (after I click it shows me a grid with elements) and then appears a `NEXT` button which redirects to the next page. I have this code:

```
((JavascriptExecutor)driver).executeScript("arguments[0].click()",driver.findElement(By.cssSelector("div#button-verify-wrapper > a")));
Thread.sleep(18000);
driver.findElement(By.xpath(".//*[@id='select-a-data-source-footer']/div/div/a")).click();
Thread.sleep(5000);

```

But I want to procced to click on the `NEXT` button, after all the grid charge (it takes a while depends on the server at that moment), because the next button just appear after the grid appears.

Are there selenium sentences to do it?