Search in sources :

Example 1 with AlertHandler

use of com.gargoylesoftware.htmlunit.AlertHandler in project ats-framework by Axway.

the class HiddenHtmlAlert method clickOk.

@Override
@PublicAtsApi
public void clickOk(final String expectedAlertText) {
    isProcessed = false;
    webClient.setAlertHandler(new AlertHandler() {

        @Override
        public void handleAlert(Page alertPage, String alertText) {
            isProcessed = true;
            if (!alertText.equals(expectedAlertText)) {
                throw new VerificationException("The expected alert message was: '" + expectedAlertText + "', but actually it is: '" + alertText + "'");
            }
        }
    });
}
Also used : VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) Page(com.gargoylesoftware.htmlunit.Page) AlertHandler(com.gargoylesoftware.htmlunit.AlertHandler) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with AlertHandler

use of com.gargoylesoftware.htmlunit.AlertHandler in project ats-framework by Axway.

the class HiddenHtmlAlert method clickOk.

@Override
@PublicAtsApi
public void clickOk() {
    isProcessed = false;
    webClient.setAlertHandler(new AlertHandler() {

        @Override
        public void handleAlert(Page alertPage, String alertText) {
            isProcessed = true;
        // do nothing, by default it clicks the OK button
        }
    });
}
Also used : Page(com.gargoylesoftware.htmlunit.Page) AlertHandler(com.gargoylesoftware.htmlunit.AlertHandler) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)2 AlertHandler (com.gargoylesoftware.htmlunit.AlertHandler)2 Page (com.gargoylesoftware.htmlunit.Page)2 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)1