Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlButton


            final HtmlSubmitInput submitInput = loginForm.getInputByName("login_submit");

            // submit consent
            final HtmlPage consentPage = submitInput.click();
            final HtmlForm consentForm = consentPage.getFormByName("consent_form");
            final HtmlButton consentAccept = consentForm.getButtonByName("consent_accept");

            // disable redirect to avoid loading redirect URL
            webClient.getOptions().setRedirectEnabled(false);

            // validate CSRF and get authorization code
            String redirectQuery;
            try {
                final Page redirectPage = consentAccept.click();
                redirectQuery = redirectPage.getUrl().getQuery();
            } catch (FailingHttpStatusCodeException e) {
                // escalate non redirect errors
                if (e.getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) {
                    throw e;
View Full Code Here


     * Simulates the addition of the new Maven via UI and makes sure it works.
     */
    public void testGlobalConfigAjax() throws Exception {
        HtmlPage p = new WebClient().goTo("configure");
        HtmlForm f = p.getFormByName("config");
        HtmlButton b = getButtonByCaption(f, "Add Maven");
        b.click();
        findPreviousInputElement(b,"name").setValueAttribute("myMaven");
        findPreviousInputElement(b,"home").setValueAttribute("/tmp/foo");
        submit(f);
        verify();

View Full Code Here

        assertTrue("Charlie should have extended read for this test", gas.hasExplicitPermission("charlie",Item.EXTENDED_READ));

        WebClient wc = new WebClient().login("charlie","charlie");
        HtmlPage page = wc.goTo("job/a/configure");
        HtmlForm form = page.getFormByName("config");
        HtmlButton saveButton = getButtonByCaption(form,"Save");
        assertNull(saveButton);
    }
View Full Code Here

    while (candidateIterator.hasNext()) {
      final HtmlElement curElement = (HtmlElement) candidateIterator.next();
      if (!(curElement instanceof HtmlButton)) {
        continue;
      }
      final HtmlButton curButton = (HtmlButton) curElement;
      LOG.debug("Examining button: " + curButton);
      if (hasMatchingNameOrDontCare(curButton) && hasMatchingLabelOrDontCare(curButton)) {
        if (indexFound == ConversionUtil.convertToInt(getFieldIndex(), 0)) {
          LOG.debug("Normal button found: " + curButton);
          return curButton;
View Full Code Here

      {
         // Find and Click save button
         e = client.getElement(customSaveId);
         assertNotNull("Control not found: "+customSaveId,e);
         assertTrue("Control not expected type (HtmlButton): "+e.getClass(),e instanceof HtmlButton);
         HtmlButton saveButton = (HtmlButton)e;
         saveButton.click();
      }
      else
      {
         // Check to see if buttons are visible
         e = client.getElement(controlId+"bar");
View Full Code Here

        HtmlForm form = authorizationPage.getFormByName("login_form");
        final HtmlTextInput email = form.getInputByName("login");
        email.setValueAttribute("testscribeup@yahoo.fr");
        final HtmlPasswordInput passwd = form.getInputByName("passwd");
        passwd.setValueAttribute("testpwdscribeup");
        final HtmlButton button = form.getButtonByName(".save");
        final HtmlPage confirmPage = button.click();
        String callbackUrl = confirmPage.getUrl().toString();
        try {
          form = confirmPage.getFormByName("rcForm");
          final HtmlSubmitInput submit = form.getInputByName("agree");
          final HtmlPage callbackPage = submit.click();
View Full Code Here

        HtmlForm form = authorizationPage.getForms().get(0);
        final HtmlTextInput login = form.getInputByName("login_email");
        login.setValueAttribute("testscribeup@gmail.com");
        final HtmlPasswordInput passwd = form.getInputByName("login_password");
        passwd.setValueAttribute("testpwdscribeup");
        HtmlButton submit = form.getButtonByName("");
        HtmlPage confirmPage = submit.click();
        confirmPage = (HtmlPage) confirmPage.refresh();
        webClient.waitForBackgroundJavaScript(5000);
        form = confirmPage.getForms().get(0);
        HtmlButton submit2 = form.getButtonByName("allow_access");
        final HtmlPage callbackPage = submit2.click();
        final String callbackUrl = callbackPage.getUrl().toString();
        logger.debug("callbackUrl : {}", callbackUrl);
        return callbackUrl;
    }
View Full Code Here

        HtmlForm form = authorizationPage.getFormByName("login_form");
        final HtmlTextInput login = form.getInputByName("login");
        login.setValueAttribute("testscribeup@yahoo.fr");
        final HtmlPasswordInput passwd = form.getInputByName("passwd");
        passwd.setValueAttribute("testpwdscribeup");
        final HtmlButton button = form.getButtonByName(".save");
        final HtmlPage confirmPage = button.click();
        form = confirmPage.getFormByName("rcForm");
        final HtmlSubmitInput submit = form.getInputByName("agree");
        final HtmlPage callbackPage = submit.click();
        final String callbackUrl = callbackPage.getUrl().toString();
        logger.debug("callbackUrl : {}", callbackUrl);
View Full Code Here

        HtmlForm form = authorizationPage.getHtmlElementById("login-form");
        HtmlTextInput username = form.getInputByName("username");
        username.setValueAttribute("testscribeup");
        HtmlPasswordInput password = form.getInputByName("password");
        password.setValueAttribute("testpwdscribeup78");
        HtmlButton submit = form.getButtonByName("submit");
        HtmlPage callbackPage = submit.click();
        final String callbackUrl = callbackPage.getUrl().toString();
        logger.debug("callbackUrl : {}", callbackUrl);
        return callbackUrl;
    }
View Full Code Here

            final HtmlSubmitInput submitInput = loginForm.getInputByName("login_submit");

            // submit consent
            final HtmlPage consentPage = submitInput.click();
            final HtmlForm consentForm = consentPage.getFormByName("consent_form");
            final HtmlButton consentAccept = consentForm.getButtonByName("consent_accept");

            // disable redirect to avoid loading redirect URL
            webClient.getOptions().setRedirectEnabled(false);

            // validate CSRF and get authorization code
            String redirectQuery;
            try {
                final Page redirectPage = consentAccept.click();
                redirectQuery = redirectPage.getUrl().getQuery();
            } catch (FailingHttpStatusCodeException e) {
                // escalate non redirect errors
                if (e.getStatusCode() != HttpStatus.SC_MOVED_TEMPORARILY) {
                    throw e;
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.html.HtmlButton

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.