private HtmlCheckBoxInput getCheckbox(String checkBoxName) { Object[] l = getForm().getInputsByName(checkBoxName).toArray(); for (int i = 0; i < l.length; i++) { if (l[i] instanceof HtmlCheckBoxInput) { return (HtmlCheckBoxInput) l[i]; } } throw new RuntimeException("No checkbox with name [" + checkBoxName + "] was found in current form."); }
/** * Returns the first input element which is a member of this form and has the specified name. * * @param name the input name to search for * @param <I> the input type * @return the first input element which is a member of this form and has the specified name * @throws ElementNotFoundException if there is not input in this form with the specified name */ @SuppressWarnings("unchecked") public final <I extends HtmlInput> I getInputByName(final String name) throws ElementNotFoundException { final List<HtmlInput> inputs = getInputsByName(name); if (inputs.isEmpty()) { throw new ElementNotFoundException(HtmlInput.TAG_NAME, "name", name); } return (I) inputs.get(0); }
/** * Returns all the {@link HtmlRadioButtonInput} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlRadioButtonInput} elements in this form that have the specified name */ public List<HtmlRadioButtonInput> getRadioButtonsByName(final String name) { WebAssert.notNull("name", name); final List<HtmlRadioButtonInput> results = new ArrayList<>(); for (final HtmlElement element : getInputsByName(name)) { if (element instanceof HtmlRadioButtonInput) { results.add((HtmlRadioButtonInput) element); } } return results; }
/** * Returns the first input element which is a member of this form and has the specified name. * * @param name the input name to search for * @param <I> the input type * @return the first input element which is a member of this form and has the specified name * @throws ElementNotFoundException if there is not input in this form with the specified name */ @SuppressWarnings("unchecked") public final <I extends HtmlInput> I getInputByName(final String name) throws ElementNotFoundException { final List<HtmlInput> inputs = getInputsByName(name); if (inputs.isEmpty()) { throw new ElementNotFoundException("input", "name", name); } return (I) inputs.get(0); }
/** * Returns the first input element which is a member of this form and has the specified name. * * @param name the input name to search for * @param <I> the input type * @return the first input element which is a member of this form and has the specified name * @throws ElementNotFoundException if there is not input in this form with the specified name */ @SuppressWarnings("unchecked") public final <I extends HtmlInput> I getInputByName(final String name) throws ElementNotFoundException { final List<HtmlInput> inputs = getInputsByName(name); if (inputs.isEmpty()) { throw new ElementNotFoundException("input", "name", name); } return (I) inputs.get(0); }
/** * Returns all the {@link HtmlRadioButtonInput} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlRadioButtonInput} elements in this form that have the specified name */ public List<HtmlRadioButtonInput> getRadioButtonsByName(final String name) { WebAssert.notNull("name", name); final List<HtmlRadioButtonInput> results = new ArrayList<HtmlRadioButtonInput>(); for (final HtmlElement element : getInputsByName(name)) { if (element instanceof HtmlRadioButtonInput) { results.add((HtmlRadioButtonInput) element); } } return results; }
/** * Returns all the {@link HtmlRadioButtonInput} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlRadioButtonInput} elements in this form that have the specified name */ public List<HtmlRadioButtonInput> getRadioButtonsByName(final String name) { WebAssert.notNull("name", name); final List<HtmlRadioButtonInput> results = new ArrayList<HtmlRadioButtonInput>(); for (final HtmlElement element : getInputsByName(name)) { if (element instanceof HtmlRadioButtonInput) { results.add((HtmlRadioButtonInput) element); } } return results; }
/** * Returns the first input element which is a member of this form and has the specified name. * * @param name the input name to search for * @param <I> the input type * @return the first input element which is a member of this form and has the specified name * @throws ElementNotFoundException if there is not input in this form with the specified name */ @SuppressWarnings("unchecked") public final <I extends HtmlInput> I getInputByName(final String name) throws ElementNotFoundException { final List<HtmlInput> inputs = getInputsByName(name); if (inputs.isEmpty()) { throw new ElementNotFoundException(HtmlInput.TAG_NAME, "name", name); } return (I) inputs.get(0); }
/** * Returns the first input element which is a member of this form and has the specified name. * * @param name the input name to search for * @param <I> the input type * @return the first input element which is a member of this form and has the specified name * @throws ElementNotFoundException if there is not input in this form with the specified name */ @SuppressWarnings("unchecked") public final <I extends HtmlInput> I getInputByName(final String name) throws ElementNotFoundException { final List<HtmlInput> inputs = getInputsByName(name); if (inputs.isEmpty()) { throw new ElementNotFoundException("input", "name", name); } return (I) inputs.get(0); }
/** * Returns all the {@link HtmlRadioButtonInput} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlRadioButtonInput} elements in this form that have the specified name */ public List<HtmlRadioButtonInput> getRadioButtonsByName(final String name) { WebAssert.notNull("name", name); final List<HtmlRadioButtonInput> results = new ArrayList<HtmlRadioButtonInput>(); for (final HtmlElement element : getInputsByName(name)) { if (element instanceof HtmlRadioButtonInput) { results.add((HtmlRadioButtonInput) element); } } return results; }
/** * Returns all the {@link HtmlRadioButtonInput} elements in this form that have the specified name. * * @param name the name to search for * @return all the {@link HtmlRadioButtonInput} elements in this form that have the specified name */ public List<HtmlRadioButtonInput> getRadioButtonsByName(final String name) { WebAssert.notNull("name", name); final List<HtmlRadioButtonInput> results = new ArrayList<>(); for (final HtmlElement element : getInputsByName(name)) { if (element instanceof HtmlRadioButtonInput) { results.add((HtmlRadioButtonInput) element); } } return results; }
private HtmlCheckBoxInput getCheckbox(String checkBoxName, String value) { Object[] l = getForm().getInputsByName(checkBoxName).toArray(); for (int i = 0; i < l.length; i++) { if ((l[i] instanceof HtmlCheckBoxInput) && ((HtmlCheckBoxInput) l[i]).getValueAttribute() .equals(value)) { return (HtmlCheckBoxInput) l[i]; } } throw new RuntimeException("No checkbox with name [" + checkBoxName + "] and value [" + value + "] was found in current form."); }
public SignupPage(HtmlPage signupPage) { this.signupPage = signupPage; assertNotNull("The sign up page has a username field.", this.signupPage.getElementById("username")); for (HtmlForm signupForm : this.signupPage.getForms()) { if (signupForm.getInputsByName("username").size() == 0) continue; this.signupForm = signupForm; } }
public HtmlElement getResetButton(String buttonName) { List<HtmlElement> btns = new LinkedList<HtmlElement>(); if (form != null) { btns.addAll(getForm().getInputsByName(buttonName)); btns.addAll(getForm().getButtonsByName(buttonName)); } else { for (HtmlForm f : getCurrentPage().getForms()) { btns.addAll(f.getInputsByName(buttonName)); btns.addAll(f.getButtonsByName(buttonName));
List<HtmlElement> btns = new LinkedList<HtmlElement>(); if (form != null) { btns.addAll(getForm().getInputsByName(buttonName)); btns.addAll(getForm().getButtonsByName(buttonName)); } else { for (HtmlForm f : getCurrentPage().getForms()) { btns.addAll(f.getInputsByName(buttonName)); btns.addAll(f.getButtonsByName(buttonName));
List<HtmlElement> btns = new LinkedList<HtmlElement>(); if (form != null) { btns.addAll(getForm().getInputsByName(buttonName)); btns.addAll(getForm().getButtonsByName(buttonName)); } else { for (HtmlForm f : getCurrentPage().getForms()) { btns.addAll(f.getInputsByName(buttonName)); btns.addAll(f.getButtonsByName(buttonName));
public void submit(String buttonName, String buttonValue) { List<HtmlElement> l = new LinkedList<HtmlElement>(); l.addAll(getForm().getInputsByName(buttonName)); l.addAll(getForm().getButtonsByName(buttonName)); try {
List<HtmlElement> btns = new LinkedList<HtmlElement>(); if (_form() != null) { btns.addAll(getForm().getInputsByName(buttonName)); btns.addAll(f.getInputsByName(buttonName));
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; }