Search in sources :

Example 1 with ConfirmHandler

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

the class HiddenHtmlConfirm method clickOk.

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

        @Override
        public boolean handleConfirm(Page currentPage, String confirmationText) {
            isProcessed = true;
            return true;
        }
    });
}
Also used : ConfirmHandler(com.gargoylesoftware.htmlunit.ConfirmHandler) Page(com.gargoylesoftware.htmlunit.Page) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with ConfirmHandler

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

the class HiddenHtmlConfirm method clickCancel.

@Override
@PublicAtsApi
public void clickCancel() {
    isProcessed = false;
    webClient.setConfirmHandler(new ConfirmHandler() {

        @Override
        public boolean handleConfirm(Page currentPage, String confirmationText) {
            isProcessed = true;
            return false;
        }
    });
}
Also used : ConfirmHandler(com.gargoylesoftware.htmlunit.ConfirmHandler) Page(com.gargoylesoftware.htmlunit.Page) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with ConfirmHandler

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

the class HiddenHtmlConfirm method clickCancel.

@Override
@PublicAtsApi
public void clickCancel(final String expectedConfirmText) {
    isProcessed = false;
    webClient.setConfirmHandler(new ConfirmHandler() {

        @Override
        public boolean handleConfirm(Page currentPage, String confirmationText) {
            isProcessed = true;
            if (!confirmationText.equals(expectedConfirmText)) {
                throw new VerificationException("The expected confirm message was: '" + expectedConfirmText + "', but actually it is: '" + confirmationText + "'");
            }
            return false;
        }
    });
}
Also used : ConfirmHandler(com.gargoylesoftware.htmlunit.ConfirmHandler) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) Page(com.gargoylesoftware.htmlunit.Page) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 4 with ConfirmHandler

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

the class HiddenHtmlConfirm method clickOk.

@Override
@PublicAtsApi
public void clickOk(final String expectedConfirmText) {
    isProcessed = false;
    webClient.setConfirmHandler(new ConfirmHandler() {

        @Override
        public boolean handleConfirm(Page currentPage, String confirmationText) {
            isProcessed = true;
            if (!confirmationText.equals(expectedConfirmText)) {
                throw new VerificationException("The expected confirm message was: '" + expectedConfirmText + "', but actually it is: '" + confirmationText + "'");
            }
            return true;
        }
    });
}
Also used : ConfirmHandler(com.gargoylesoftware.htmlunit.ConfirmHandler) VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) Page(com.gargoylesoftware.htmlunit.Page) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)4 ConfirmHandler (com.gargoylesoftware.htmlunit.ConfirmHandler)4 Page (com.gargoylesoftware.htmlunit.Page)4 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)2