use of com.axway.ats.uiengine.internal.realbrowser.IExpectedPopup in project ats-framework by Axway.
the class AbstractRealBrowserDriver method handleExpectedPopups.
/**
* <b>Note:</b> For internal use only
*/
public void handleExpectedPopups() {
while (!expectedPopupsQueue.isEmpty()) {
IExpectedPopup expectedPopup = expectedPopupsQueue.poll();
if (expectedPopup instanceof ExpectedAlert) {
ExpectedAlert expectedAlert = (ExpectedAlert) expectedPopup;
new RealHtmlElementState(new RealHtmlAlert(this)).waitToBecomeExisting();
Alert alert = getAlert();
if (expectedAlert.expectedText != null && !expectedAlert.expectedText.equals(alert.getText())) {
throw new VerificationException("The expected alert message was: '" + expectedAlert.expectedText + "', but actually it is: '" + alert.getText() + "'");
}
alert.accept();
} else if (expectedPopup instanceof ExpectedPrompt) {
ExpectedPrompt expectedPrompt = (ExpectedPrompt) expectedPopup;
new RealHtmlElementState(new RealHtmlPrompt(this)).waitToBecomeExisting();
Alert prompt = getAlert();
if (expectedPrompt.expectedText != null && !expectedPrompt.expectedText.equals(prompt.getText())) {
throw new VerificationException("The expected prompt text was: '" + expectedPrompt.expectedText + "', but actually it is: '" + prompt.getText() + "'");
}
if (expectedPrompt.clickOk) {
prompt.sendKeys(expectedPrompt.promptValueToSet);
prompt.accept();
} else {
prompt.dismiss();
}
} else if (expectedPopup instanceof ExpectedConfirm) {
ExpectedConfirm expectedConfirm = (ExpectedConfirm) expectedPopup;
new RealHtmlElementState(new RealHtmlConfirm(this)).waitToBecomeExisting();
Alert confirm = getAlert();
if (expectedConfirm.expectedText != null && !expectedConfirm.expectedText.equals(confirm.getText())) {
throw new VerificationException("The expected confirmation message was: '" + expectedConfirm.expectedText + "', but actually it is: '" + confirm.getText() + "'");
}
if (expectedConfirm.clickOk) {
confirm.accept();
} else {
confirm.dismiss();
}
}
UiEngineUtilities.sleep();
}
}
Aggregations