In Selenium Webdriver, two conditions can be used to check if the page is loaded before finding any element on the page:
WebDriverWait wait = new WebDriverWait(driver, 50);
Using below readyState will wait till page load
wait.until((ExpectedCondition<Boolean>) wd -> ((JavascriptExecutor) wd).executeScript("return document.readyState").equals("complete"));
Below JQuery will wait till data has not been loaded
int count =0; if((Boolean) executor.executeScript("return window.jQuery != undefined")){ while(!(Boolean) executor.executeScript("return jQuery.active == 0")){ Thread.sleep(4000); if(count>4) break; count++; } }
After these JavaScriptCode try to findOut webElement.
WebElement we = wait.until(ExpectedConditions.presenceOfElementLocated(by));
Hope this helps!
To learn in-depth about Selenium, sign up for an industry based Selenium course.