WebClient wc = new WebClient();
wc.setThrowExceptionOnFailingStatusCode(false);
HtmlPage page = wc.goTo("/job/" + project.getName() + "/build?delay=0sec");
HtmlForm form = page.getFormByName("parameters");
HtmlElement element = (HtmlElement) form.selectSingleNode("//tr[td/div/input/@value='string']");
assertNotNull(element);
assertEquals("string description", ((HtmlElement) element.selectSingleNode("td/div")).getAttribute("description"));
HtmlTextInput stringParameterInput = (HtmlTextInput) element.selectSingleNode(".//input[@name='value']");
assertEquals("defaultValue", stringParameterInput.getAttribute("value"));
assertEquals("string", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent());
stringParameterInput.setAttribute("value", "newValue");
element = (HtmlElement) form.selectSingleNode("//tr[td/div/input/@value='boolean']");
assertNotNull(element);
assertEquals("boolean description", ((HtmlElement) element.selectSingleNode("td/div")).getAttribute("description"));
Object o = element.selectSingleNode(".//input[@name='value']");
System.out.println(o);
HtmlCheckBoxInput booleanParameterInput = (HtmlCheckBoxInput) o;
assertEquals(true, booleanParameterInput.isChecked());
assertEquals("boolean", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent());
element = (HtmlElement) form.selectSingleNode(".//tr[td/div/input/@value='choice']");
assertNotNull(element);
assertEquals("choice description", ((HtmlElement) element.selectSingleNode("td/div")).getAttribute("description"));
assertEquals("choice", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent());
element = (HtmlElement) form.selectSingleNode(".//tr[td/div/input/@value='run']");
assertNotNull(element);
assertEquals("run description", ((HtmlElement) element.selectSingleNode("td/div")).getAttribute("description"));
assertEquals("run", ((HtmlElement) element.selectSingleNode("td[@class='setting-name']")).getTextContent());
submit(form);