Search in sources :

Example 26 with Page

use of com.gargoylesoftware.htmlunit.Page 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 27 with Page

use of com.gargoylesoftware.htmlunit.Page 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 28 with Page

use of com.gargoylesoftware.htmlunit.Page 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 29 with Page

use of com.gargoylesoftware.htmlunit.Page 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 30 with Page

use of com.gargoylesoftware.htmlunit.Page 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

Page (com.gargoylesoftware.htmlunit.Page)62 Test (org.junit.Test)39 WebClient (com.gargoylesoftware.htmlunit.WebClient)33 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)15 PublicAtsApi (com.axway.ats.common.PublicAtsApi)9 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)5 File (java.io.File)5 IOException (java.io.IOException)5 URL (java.net.URL)5 JenkinsRule (org.jvnet.hudson.test.JenkinsRule)5 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)4 ConfirmHandler (com.gargoylesoftware.htmlunit.ConfirmHandler)4 Map (java.util.Map)4 JSONObject (net.sf.json.JSONObject)4 RsaJsonWebKey (org.jose4j.jwk.RsaJsonWebKey)4 JsonWebSignature (org.jose4j.jws.JsonWebSignature)4 JwtClaims (org.jose4j.jwt.JwtClaims)4 JwtConsumer (org.jose4j.jwt.consumer.JwtConsumer)4 JwtConsumerBuilder (org.jose4j.jwt.consumer.JwtConsumerBuilder)4 JsonWebStructure (org.jose4j.jwx.JsonWebStructure)4