Hi, I got some issue when I try to use AbstractPageElement.redirectTo with an opened alert on a page.
It happens because of PageLoaded.class which try to get a state of the page by JavaScript.
JavaScript will close the alert.
I suggest a solution, before using PageLoaded.class just check is an alert opened or not, for example, by this method:
public static boolean alertIsPresent() {
try {
WebDriverWait wait = new WebDriverWait(getWebDriver(), 0);
return wait.until(ExpectedConditions.alertIsPresent()) != null;
} catch (TimeoutException e) {
return false;
}
}