Try to get the pageSource several times when the progress bar is visible.
Print the pageSourse in console then try to search for the element by copying the xml in a text file.
String xml1 = driver.getPageSource();
u.wait(500);
String xml2 = driver.getPageSource();
u.wait(200);
String xml3 = driver.getPageSource();
u.wait(300);
String xml4 = driver.getPageSource();
u.wait(300);
String xml5 = driver.getPageSource();
u.wait(200);
String xml6 = driver.getPageSource();
log.info("1: "+xml1);
log.info("2: "+xml2);
log.info("3: "+xml3);
log.info("4: "+xml4);
log.info("5: "+xml5);
log.info("6: "+xml6);
You will find it for sure. Once you know the ID if the element you can do like this with uiAutomator2
public boolean waitForProgressBarToDisappear() {
WebDriverWait wait = new WebDriverWait(driver, BaseSetup.EXPLICIT_WAIT_TIME, 0);
try {
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("progress_bar")));
log.info("Progress bar no longer displayed, moving forward with the steps...");
return true;
} catch (NoSuchElementException e) {
log.info(e);
return true;
}
}