Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput


    }
    return li;
  }

  protected void verifyField(final HtmlElement element) {
    HtmlCheckBoxInput checkbox = (HtmlCheckBoxInput) element;
    if (checkbox.isChecked() != ConversionUtil.convertToBoolean(getChecked(), false)) {
      throw new StepFailedException("Checkbox is " + (checkbox.isChecked() ? "" : "not") + "checked!", this);
    }
  }
View Full Code Here


        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
       
        HtmlCheckBoxInput catalogItems = (HtmlCheckBoxInput) form.getInputByName("items");

        System.out.println(">>>" + catalogItems.getAttribute("value"));
        Assert.assertEquals("Apple - $2.99", catalogItems.getAttribute("value"));

        webClient.closeAllWindows();
    }
View Full Code Here

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
       
        HtmlCheckBoxInput catalogItems = (HtmlCheckBoxInput) form.getInputByName("items");

        System.out.println(">>>" + catalogItems.getAttribute("value"));
        Assert.assertEquals("Apple - $2.99", catalogItems.getAttribute("value"));

        webClient.closeAllWindows();
    }
View Full Code Here

        assertTrue(!page.asText().contains("new value"));

        list = getAllElementsOfGivenClass(page,
                                          null,
                                          HtmlCheckBoxInput.class);
        HtmlCheckBoxInput input = (HtmlCheckBoxInput) list.get(0);
        input.setChecked(false);
        list = getAllElementsOfGivenClass(page,
                                               null,
                                               HtmlSubmitInput.class);
        button = (HtmlSubmitInput) list.get(0);
        page = (HtmlPage) button.click();
View Full Code Here

    public void logInAndRememberMe() throws Exception {
        HtmlPage page = webClient.getPage(getBaseUri() + "login.jsp");
        HtmlForm form = page.getFormByName("loginform");
        form.<HtmlInput>getInputByName("username").setValueAttribute("root");
        form.<HtmlInput>getInputByName("password").setValueAttribute("secret");
        HtmlCheckBoxInput checkbox = form.getInputByName("rememberMe");
        checkbox.setChecked(true);
        page = form.<HtmlInput>getInputByName("submit").click();
        server.stop();
        server.start();
        page = webClient.getPage(getBaseUri());
        // page.getAnchorByHref("/logout");
View Full Code Here

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
       
        HtmlCheckBoxInput catalogItems = (HtmlCheckBoxInput) form.getInputByName("items");

        System.out.println(">>>" + catalogItems.getAttribute("value"));
        Assert.assertEquals("Apple - $2.99", catalogItems.getAttribute("value"));

        webClient.closeAllWindows();
    }
View Full Code Here

        HtmlTable resultsTableElm = ((HtmlForm)client.getElement("parametersForm")).getFirstByXPath(".//table[@class='properties-table']");
        ContentTable resultsTable = ejtt.getTable(resultsTableElm);

        ContentTableRow row = resultsTable.getFirstRowContainingText("Command Line Arguments");
        assertNotNull("'Command Line Arguments' row not found.", row);
        HtmlCheckBoxInput unsetCheckbox = row./*getCellByColumnName("Unset").*/ getElement().getFirstByXPath(".//input[@type='checkbox']");
        unsetCheckbox.setChecked(false);
        HtmlTextArea argsTA = row./*getCellByColumnName("Value").*/ getElement().getFirstByXPath(".//textarea"); // [@ondblclick='commandLineArguments']
        argsTA.setText("-c");
        DebugUtils.writeFile("target/scriptsWithParam-settingParams.html", client.getPageAsText());

        ejtt.sleep(2000);
View Full Code Here

    public JenkinsRule j = new JenkinsRule();
   
    @Test
    public void testAllowTokenMacro() throws Exception {
        HtmlPage page = j.createWebClient().goTo("configure");
        HtmlCheckBoxInput allowMacroCheckBox = page.getElementByName("allowMacro");
        allowMacroCheckBox.setChecked(true);
        j.submit(page.getFormByName("config"));
        Groovy.DescriptorImpl descriptor = (Groovy.DescriptorImpl) j.jenkins.getDescriptor(Groovy.class);
        assertTrue(descriptor.getAllowMacro());
    }
View Full Code Here

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
        }
       
        HtmlCheckBoxInput catalogItems = (HtmlCheckBoxInput) form.getInputByName("items");

        System.out.println(">>>" + catalogItems.getAttribute("value"));
        Assert.assertEquals("Apple - $2.99", catalogItems.getAttribute("value"));

        webClient.closeAllWindows();
    }
View Full Code Here

    hiddenSchemaValueField = htmlUnitPage.getHtmlForm().getInputByName("schemavalue");
    assertEquals("[\"dn\",\"employeenumber\",\"employeestatus\"]",
        hiddenSchemaValueField.getValueAttribute());

    // de-select employeestatus checkbox and verify results
    HtmlCheckBoxInput chkFieldBefore = htmlUnitPage.getHtmlForm().getInputByValue("employeestatus");
    assertTrue(chkFieldBefore.isChecked());
    HtmlPage page2 = chkFieldBefore.click();
    HtmlCheckBoxInput chkFieldAfter = htmlUnitPage.getHtmlForm().getInputByValue("employeestatus");
    hiddenSchemaValueField = htmlUnitPage.getHtmlForm().getInputByName("schemavalue");
    assertFalse(chkFieldAfter.isChecked());
    assertEquals("[\"dn\",\"employeenumber\"]", hiddenSchemaValueField.getValueAttribute());

    // de-select employeenumber checkbox and verify results
    chkFieldBefore = htmlUnitPage.getHtmlForm().getInputByValue("employeenumber");
    assertTrue(chkFieldBefore.isChecked());
    HtmlPage page3 = chkFieldBefore.click();
    chkFieldAfter = htmlUnitPage.getHtmlForm().getInputByValue("employeenumber");
    hiddenSchemaValueField = htmlUnitPage.getHtmlForm().getInputByName("schemavalue");
    assertFalse(chkFieldAfter.isChecked());
    assertEquals("[\"dn\"]", hiddenSchemaValueField.getValueAttribute());

    htmlUnitPage.getWebClient().closeAllWindows();
  }
View Full Code Here

TOP

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

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.