Manage exceptions in waitForPageToLoad for chrome error in version 132

Closes #36781
Closes #36782
Closes #36902

Signed-off-by: rmartinc <rmartinc@redhat.com>
(cherry picked from commit efbeb8caa6)
This commit is contained in:
Ricardo Martin
2025-02-04 10:06:00 +01:00
committed by GitHub
parent 153cc24e57
commit cae58cb0dc

View File

@@ -135,13 +135,17 @@ public final class WaitUtils {
// Ensure the URL is "stable", i.e. is not changing anymore; if it'd changing, some redirects are probably still in progress
for (int maxRedirects = 4; maxRedirects > 0; maxRedirects--) {
currentUrl = driver.getCurrentUrl();
FluentWait<WebDriver> wait = new FluentWait<>(driver).withTimeout(Duration.ofMillis(250));
try {
currentUrl = driver.getCurrentUrl();
FluentWait<WebDriver> wait = new FluentWait<>(driver).withTimeout(Duration.ofMillis(250));
wait.until(not(urlToBe(currentUrl)));
}
catch (TimeoutException e) {
break; // URL has not changed recently - ok, the URL is stable and page is current
} catch (TimeoutException e) {
if (driver.getPageSource() != null) {
break; // URL has not changed recently - ok, the URL is stable and page is current
}
} catch (Exception e) {
log.warnf("Unknown exception thrown waiting stabilization of the URL: %s", e.getMessage());
pause(250);
}
if (maxRedirects == 1) {
log.warn("URL seems unstable! (Some redirect are probably still in progress)");