Beispiel #1
0
 /**
  * @param forms
  * @return
  */
 public static HtmlForm getFormWithPasswordInput(final List<HtmlForm> forms) {
   for (final HtmlForm form : forms) {
     for (final HtmlElement input : form.getElementsByTagName("input")) {
       if (input.getAttribute("type").equalsIgnoreCase("password")) {
         return form;
       }
     }
   }
   return null;
 }
Beispiel #2
0
  public static List<HtmlSelect> getSelects(final HtmlForm form) {
    final List<HtmlSelect> ret = new ArrayList<HtmlSelect>();
    for (final HtmlElement element : form.getElementsByTagName("select")) {
      if (element instanceof HtmlSelect) {
        ret.add((HtmlSelect) element);
      }
    }

    // collect selects from lost children
    for (final HtmlElement elt : form.getLostChildren()) {
      if (elt instanceof HtmlSelect) {
        ret.add((HtmlSelect) elt);
      }
    }
    return ret;
  }