I can write the following code to ask WebDriver to wait for sometime
new WebDriverWait(driver, 20).until(ExpectedConditions.presenceOfElementLocated(By.id("loginBox")));
But,
Actually I sending AJAX request to the server. Here I gave 20 milli seconds to wait. 20msor 500ms doesn't matter. If the response exceeds the given time (Eg 20ms). Then I'll exception that No Such Element found.
So Is there a better way to ask the server to wait?
Can anyone help me?
Thanks in advance, Gnik