/** * Returns the first input in this form with the specified value. * @param value the value to search for * @param <I> the input type * @return the first input in this form with the specified value * @throws ElementNotFoundException if this form does not contain any inputs with the specified value */ @SuppressWarnings("unchecked") public <I extends HtmlInput> I getInputByValue(final String value) throws ElementNotFoundException { final List<HtmlInput> list = getInputsByValue(value); if (list.isEmpty()) { throw new ElementNotFoundException(HtmlInput.TAG_NAME, "value", value); } return (I) list.get(0); }
/** * Returns the first input in this form with the specified value. * @param value the value to search for * @param <I> the input type * @return the first input in this form with the specified value * @throws ElementNotFoundException if this form does not contain any inputs with the specified value */ @SuppressWarnings("unchecked") public <I extends HtmlInput> I getInputByValue(final String value) throws ElementNotFoundException { final List<HtmlInput> list = getInputsByValue(value); if (list.isEmpty()) { throw new ElementNotFoundException("input", "value", value); } return (I) list.get(0); }
/** * Returns the first input in this form with the specified value. * @param value the value to search for * @param <I> the input type * @return the first input in this form with the specified value * @throws ElementNotFoundException if this form does not contain any inputs with the specified value */ @SuppressWarnings("unchecked") public <I extends HtmlInput> I getInputByValue(final String value) throws ElementNotFoundException { final List<HtmlInput> list = getInputsByValue(value); if (list.isEmpty()) { throw new ElementNotFoundException("input", "value", value); } return (I) list.get(0); }
/** * Returns the first input in this form with the specified value. * @param value the value to search for * @param <I> the input type * @return the first input in this form with the specified value * @throws ElementNotFoundException if this form does not contain any inputs with the specified value */ @SuppressWarnings("unchecked") public <I extends HtmlInput> I getInputByValue(final String value) throws ElementNotFoundException { final List<HtmlInput> list = getInputsByValue(value); if (list.isEmpty()) { throw new ElementNotFoundException("input", "value", value); } return (I) list.get(0); }
/** * Returns the first input in this form with the specified value. * @param value the value to search for * @param <I> the input type * @return the first input in this form with the specified value * @throws ElementNotFoundException if this form does not contain any inputs with the specified value */ @SuppressWarnings("unchecked") public <I extends HtmlInput> I getInputByValue(final String value) throws ElementNotFoundException { final List<HtmlInput> list = getInputsByValue(value); if (list.isEmpty()) { throw new ElementNotFoundException(HtmlInput.TAG_NAME, "value", value); } return (I) list.get(0); }
final WebClient webClient = new WebClient(); final HtmlPage page1 = webClient.getPage("http://www.facebook.com"); final HtmlForm form = page1.getFormByName("login_form"); final HtmlSubmitInput button = form.getInputsByValue("Log in"); final HtmlTextInput textField = form.getInputByName("email"); textField.setValueAttribute("jon@jon.com"); final HtmlTextInput textField = form.getInputByName("pass"); textField.setValueAttribute("ahhhh"); final HtmlPage page2 = button.click();
final WebClient webClient = new WebClient(); final HtmlPage page1 = webClient.getPage("http://www.facebook.com"); final HtmlForm form = page1.getFormByName("login_form"); final HtmlSubmitInput button = form.getInputsByValue("Log in"); final HtmlTextInput textField = form.getInputByName("email"); textField.setValueAttribute("youremailaddress@domain.com"); final HtmlTextInput textField = form.getInputByName("pass"); textField.setValueAttribute("yourPassword"); final HtmlPage page2 = button.click();
final WebClient webClient = new WebClient(); final HtmlPage page1 = webClient.getPage("http://www.facebook.com"); final HtmlForm form = (HtmlForm) page1.getElementById("login_form"); final HtmlSubmitInput button = (HtmlSubmitInput) form.getInputsByValue("Log In").get(0); final HtmlTextInput textField = form.getInputByName("email"); textField.setValueAttribute("jon@jon.com"); final HtmlPasswordInput textField2 = form.getInputByName("pass"); textField2.setValueAttribute("ahhhh"); final HtmlPage page2 = button.click();