Search in sources :

Example 1 with PromptHandler

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

the class HiddenHtmlPrompt method clickCancel.

@Override
@PublicAtsApi
public void clickCancel(final String expectedText) {
    isProcessed = false;
    webClient.setPromptHandler(new PromptHandler() {

        @Override
        public String handlePrompt(Page currentPage, String promptText, String defaultValue) {
            isProcessed = true;
            if (!promptText.equals(expectedText)) {
                throw new VerificationException("The expected prompt text was: '" + expectedText + "', but actually it is: '" + promptText + "'");
            }
            return null;
        }
    });
}
Also used : VerificationException(com.axway.ats.uiengine.exceptions.VerificationException) Page(com.gargoylesoftware.htmlunit.Page) PromptHandler(com.gargoylesoftware.htmlunit.PromptHandler) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with PromptHandler

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

the class HiddenHtmlPrompt method clickOk.

@Override
@PublicAtsApi
public void clickOk(final String promptValue) {
    isProcessed = false;
    webClient.setPromptHandler(new PromptHandler() {

        @Override
        public String handlePrompt(Page currentPage, String promptText, String defaultValue) {
            isProcessed = true;
            return promptValue;
        }
    });
}
Also used : Page(com.gargoylesoftware.htmlunit.Page) PromptHandler(com.gargoylesoftware.htmlunit.PromptHandler) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 3 with PromptHandler

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

the class HiddenHtmlPrompt method clickCancel.

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

        @Override
        public String handlePrompt(Page currentPage, String promptText, String defaultValue) {
            isProcessed = true;
            return null;
        }
    });
}
Also used : Page(com.gargoylesoftware.htmlunit.Page) PromptHandler(com.gargoylesoftware.htmlunit.PromptHandler) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Aggregations

PublicAtsApi (com.axway.ats.common.PublicAtsApi)3 Page (com.gargoylesoftware.htmlunit.Page)3 PromptHandler (com.gargoylesoftware.htmlunit.PromptHandler)3 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)1