Package com.gargoylesoftware.htmlunit.html

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm


        //webClient.waitForBackgroundJavaScriptStartingBefore(100000);
        webClient.setAjaxController(new NicelyResynchronizingAjaxController());

        HtmlPage page = (HtmlPage) webClient.getPage("http://localhost:8080/store/store.html");

        HtmlForm form = (HtmlForm) page.getFormByName("catalogForm");

        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


        // Get the first page
        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);

        // Get the form that we are dealing with and within that form,
        // find the submit button and the field that we want to change.
        final HtmlForm form = (HtmlForm) page.getForms().get(0);
        final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFill");
        // Now submit the form by clicking the button
        final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();

        //verify the resultPage
        String responseText = resultPage.asText();
View Full Code Here

        // Get the first page
        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);

        // Get the form that we are dealing with and within that form,
        // find the submit button and the field that we want to change.
        final HtmlForm form = (HtmlForm) page.getForms().get(0);
        final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doFillAll");
        // Now submit the form by clicking the button
        final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();

        //verify the resultPage
        String responseText = resultPage.asText();
View Full Code Here

        // Get the first page
        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);

        // Get the form that we are dealing with and within that form,
        // find the submit button and the field that we want to change.
        final HtmlForm form = (HtmlForm) page.getForms().get(0);
        final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doAddDepartment");
        // Now submit the form by clicking the button
        final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();

        //verify the resultPage
        String responseText = resultPage.asText();
View Full Code Here

        // Get the first page
        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);

        // Get the form that we are dealing with and within that form,
        // find the submit button and the field that we want to change.
        final HtmlForm form = (HtmlForm) page.getForms().get(0);
        final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doChangeDepartmentNames");
        // Now submit the form by clicking the button
        final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();

        //verify the resultPage
        String responseText = resultPage.asText();
View Full Code Here

        // Get the first page
        final HtmlPage page = (HtmlPage) _webClient.getPage(_url);

        // Get the form that we are dealing with and within that form,
        // find the submit button and the field that we want to change.
        final HtmlForm form = (HtmlForm) page.getForms().get(0);
        final HtmlSubmitInput allCompaniesButton = (HtmlSubmitInput)form.getHtmlElementById("doDeleteDepartments");
        // Now submit the form by clicking the button
        final HtmlPage resultPage = (HtmlPage)allCompaniesButton.click();

        //verify the resultPage
        String responseText = resultPage.asText();
View Full Code Here

                Collections.singleton(new EnvironmentVariablesNodeProperty(
                        new Entry("KEY", "value"))));
   
    WebClient webClient = new WebClient();
    HtmlPage page = webClient.getPage(hudson, "configure");
    HtmlForm form = page.getFormByName("config");
    submit(form);
   
    Assert.assertEquals(1, hudson.getGlobalNodeProperties().toList().size());
   
    EnvironmentVariablesNodeProperty prop = hudson.getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class);
View Full Code Here

  public void testFormRoundTripForSlave() throws Exception {
    setVariables(slave, new Entry("KEY", "value"));
   
    WebClient webClient = new WebClient();
    HtmlPage page = webClient.getPage(slave, "configure");
    HtmlForm form = page.getFormByName("config");
    submit(form);
   
    Assert.assertEquals(1, slave.getNodeProperties().toList().size());
   
    EnvironmentVariablesNodeProperty prop = slave.getNodeProperties().get(EnvironmentVariablesNodeProperty.class);
View Full Code Here

        PageDecorator.ALL.add(pageDecoratorImpl);
       
        HtmlPage page = new WebClient().goTo("configure");
        assertXPath(page,"//tr[@name='hudson-pages-SystemConfigurationTestCase$PageDecoratorImpl']");

        HtmlForm form = page.getFormByName("config");
        form.getInputByName("_.decoratorId").setValueAttribute("this_is_a_profile");
        submit(form);
        assertEquals("The decorator field was incorrect", "this_is_a_profile", pageDecoratorImpl.getDecoratorId());
    }
View Full Code Here

    public void testActivated() throws Exception {
        for( int i=0; i<=TooManyJobsButNoView.THRESHOLD; i++ )
            createFreeStyleProject();

        HtmlPage p = new WebClient().goTo("manage");
        HtmlForm f = p.getFormByName(mon.id);
        assertNotNull(f);

        // this should take us to the new view page
        URL url = submit(f,"yes").getWebResponse().getUrl();
        assertTrue(url.toExternalForm(),url.toExternalForm().endsWith("/newView"));
View Full Code Here

TOP

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

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.