Exemplo n.º 1
0
 /**
  * Looks for submit by name first, then by value. Buttons can exist without a name, which will
  * cause the browser to not submit that button's name and value.
  *
  * @throws Exception
  */
 public void testSubmit() throws Exception {
   TesterForm form =
       new TesterForm(
           elementForHtml(
               "<form name=\"my form\"><input  name=\"the.name\" type=\"submit\"   value=\"valueValue\"    /><input type=\"submit\" value=\"theValue\" /></form>"),
           "my form");
   form.submit("the.name"); // look by name first
   form.submit("theValue"); // then by value, if no name
   try {
     form.submit("someOther");
     throw new RuntimeException("Assertion should fail");
   } catch (NoSuchElementError expected) {
   }
 }