/** * Returns all the {@code <input type="submit">} elements in this form. */ public static List<HtmlElement> getSubmitButtons(final HtmlForm htmlForm) throws ElementNotFoundException { final List<HtmlElement> list = htmlForm.getElementsByAttribute("input", "type", "submit"); // collect inputs from lost children for (final HtmlElement elt : htmlForm.getLostChildren()) { list.add(elt); } return list; }
/** * Returns all the <input type="submit"> elements in this form. */ public List<HtmlSubmitInput> getSubmitButtons() throws ElementNotFoundException { final List<HtmlSubmitInput> list = getElementsByAttribute("input", "type", "submit"); // collect inputs from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlSubmitInput) { list.add((HtmlSubmitInput) elt); } } return list; }
/** * Returns all the <input type="submit"> elements in this form. */ public List<HtmlSubmitInput> getSubmitButtons() throws ElementNotFoundException { final List<HtmlSubmitInput> list = getElementsByAttribute("input", "type", "submit"); // collect inputs from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlSubmitInput) { list.add((HtmlSubmitInput) elt); } } return list; }
HtmlForm form = page.getForms().get(0); HtmlElement input = form.getElementsByAttribute("input", "name", "vote").get(0); page = input.click();
/** * Returns all the inputs in this form with the specified value. * @param value the value to search for * @return all the inputs in this form with the specified value */ public List<HtmlInput> getInputsByValue(final String value) { final List<HtmlInput> results = getElementsByAttribute("input", "value", value); for (final HtmlElement element : getLostChildren()) { if (element instanceof HtmlInput && value.equals(element.getAttribute("value"))) { results.add((HtmlInput) element); } } return results; }
/** * Returns all the inputs in this form with the specified value. * @param value the value to search for * @return all the inputs in this form with the specified value */ public List<HtmlInput> getInputsByValue(final String value) { final List<HtmlInput> results = getElementsByAttribute("input", "value", value); for (final HtmlElement element : getLostChildren()) { if (element instanceof HtmlInput && value.equals(element.getAttribute("value"))) { results.add((HtmlInput) element); } } return results; }
/** * Returns all the {@link HtmlSelect} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlSelect} elements in this form that have the specified name */ public List<HtmlSelect> getSelectsByName(final String name) { final List<HtmlSelect> list = getElementsByAttribute("select", "name", name); // collect selects from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlSelect && name.equals(elt.getAttribute("name"))) { list.add((HtmlSelect) elt); } } return list; }
/** * Returns all the inputs in this form with the specified value. * @param value the value to search for * @return all the inputs in this form with the specified value */ public List<HtmlInput> getInputsByValue(final String value) { final List<HtmlInput> results = getElementsByAttribute("input", "value", value); for (final HtmlElement element : getLostChildren()) { if (element instanceof HtmlInput && value.equals(element.getAttribute("value"))) { results.add((HtmlInput) element); } } return results; }
/** * Returns all input elements which are members of this form and have the specified name. * * @param name the input name to search for * @return all input elements which are members of this form and have the specified name */ public List<HtmlInput> getInputsByName(final String name) { final List<HtmlInput> list = getElementsByAttribute("input", "name", name); // collect inputs from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlInput && name.equals(elt.getAttribute("name"))) { list.add((HtmlInput) elt); } } return list; }
/** * Returns all the {@link HtmlSelect} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlSelect} elements in this form that have the specified name */ public List<HtmlSelect> getSelectsByName(final String name) { final List<HtmlSelect> list = getElementsByAttribute("select", "name", name); // collect selects from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlSelect && name.equals(elt.getAttribute("name"))) { list.add((HtmlSelect) elt); } } return list; }
/** * Returns all the {@link HtmlButton} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlButton} elements in this form that have the specified name */ public List<HtmlButton> getButtonsByName(final String name) { final List<HtmlButton> list = getElementsByAttribute("button", "name", name); // collect buttons from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlButton && name.equals(elt.getAttribute("name"))) { list.add((HtmlButton) elt); } } return list; }
/** * Returns all the {@link HtmlButton} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlButton} elements in this form that have the specified name */ public List<HtmlButton> getButtonsByName(final String name) { final List<HtmlButton> list = getElementsByAttribute("button", "name", name); // collect buttons from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlButton && name.equals(elt.getAttribute("name"))) { list.add((HtmlButton) elt); } } return list; }
/** * Returns all input elements which are members of this form and have the specified name. * * @param name the input name to search for * @return all input elements which are members of this form and have the specified name */ public List<HtmlInput> getInputsByName(final String name) { final List<HtmlInput> list = getElementsByAttribute("input", "name", name); // collect inputs from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlInput && name.equals(elt.getAttribute("name"))) { list.add((HtmlInput) elt); } } return list; }
/** * Returns all the {@link HtmlTextArea} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlTextArea} elements in this form that have the specified name */ public List<HtmlTextArea> getTextAreasByName(final String name) { final List<HtmlTextArea> list = getElementsByAttribute("textarea", "name", name); // collect buttons from lost children for (final HtmlElement elt : getLostChildren()) { if (elt instanceof HtmlTextArea && name.equals(elt.getAttribute("name"))) { list.add((HtmlTextArea) elt); } } return list; }
/** * Returns the value of the JavaScript attribute "length". * Does not count input type=image elements as browsers (IE6, Mozilla 1.7) do * (cf <a href="http://msdn.microsoft.com/en-us/library/ms534101.aspx">MSDN doc</a>) * @return the value of this attribute */ public int jsxGet_length() { final int all = jsxGet_elements().jsxGet_length(); final int images = getHtmlForm().getElementsByAttribute("input", "type", "image").size(); return all - images; }
/** * Returns the value of the JavaScript attribute "length". * Does not count input type=image elements as browsers (IE6, Mozilla 1.7) do * (cf <a href="http://msdn.microsoft.com/en-us/library/ms534101.aspx">MSDN doc</a>) * @return the value of this attribute */ public int jsxGet_length() { final int all = jsxGet_elements().jsxGet_length(); final int images = getHtmlForm().getElementsByAttribute("input", "type", "image").size(); return all - images; }
/** * Returns the value of the JavaScript attribute "length". * Does not count input type=image elements as browsers (IE6, Mozilla 1.7) do * (cf <a href="http://msdn.microsoft.com/en-us/library/ms534101.aspx">MSDN doc</a>) * @return the value of this attribute */ public int jsxGet_length() { final int all = jsxGet_elements().jsxGet_length(); final int images = getHtmlForm().getElementsByAttribute("input", "type", "image").size(); return all - images; }
/** * Returns the value of the property {@code length}. * Does not count input {@code type=image} elements * (<a href="http://msdn.microsoft.com/en-us/library/ms534101.aspx">MSDN doc</a>) * @return the value of this property */ @JsxGetter public int getLength() { final int all = getElements().getLength(); final int images = getHtmlForm().getElementsByAttribute(HtmlInput.TAG_NAME, "type", "image").size(); return all - images; }
/** * Returns the value of the property {@code length}. * Does not count input {@code type=image} elements * (<a href="http://msdn.microsoft.com/en-us/library/ms534101.aspx">MSDN doc</a>) * @return the value of this property */ @JsxGetter public int getLength() { final int all = getElements().getLength(); final int images = getHtmlForm().getElementsByAttribute(HtmlInput.TAG_NAME, "type", "image").size(); return all - images; }
private HtmlPage submitNewRepositoryForm(HtmlPage page) throws IOException { for (HtmlForm form : page.getForms()) { for (HtmlInput mode : form.getInputsByName("mode")) { if ("new".equals(mode.getValueAttribute())) { for (HtmlInput home : form.getInputsByName("repository_home")) { home.setValueAttribute("target/repository"); for (HtmlElement submit : form.getElementsByAttribute("input", "type", "submit")) { return submit.click(); } } } } } fail(); return null; }