Use Waits in Selenium WebDriver to wait for an element to load, refer the example below:
(new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver drive) {
return drive.findElement(...).getText().length() != 0;
}
});