Methods for Navigation

Forms

When you use the form parameter in the find command and the searched form is found, digger goes into the form context. In this context, you can fill out the form fields with data, submit forms to the server, and simulate clicks on the form buttons.

The following commands are supported in the form context:

Command Description
fields_set The command sets the form fields using the specified values. Fields must be referenced through their names, in other words through the value specified in the name attribute of the field tag.
submit This command submits form to the server.
click The command do click the button, defined by name or id, provided as parameter for this command.

As example lets use the following HTML source:

          <form name="form1" method="POST">
    <input type="text" name="textfield" value="5">
    <input type="checkbox" name="checkbox" value="yes">
    <select name="select1" >
        <option value="yes">yes</option>
        <option value="no">no</option>
    </select>
    <input type="submit" value="send">

    <button name="submitbutton" type="submit">send</button>
</form>
          

Here is how we could work with such form:

              - find:
  form: "form#form1"
  do:
  # SUBMITTING THE FORM
  - submit
              
              - find:
  form: "form#form1"
  do:
  # FILLING OUT THE FORM FIELDS WITH VALUES
  - fields_set:
    textfield: 10442
    checkbox: no
    select1: yes
  # SUBMITTING THE FORM
  - submit
              
              - find:
  form: "form#form1"
  do:
  # FILLING OUT THE FORM FIELDS WITH VALUES
  - fields_set:
    textfield: 1023
    checkbox: yes
    select1: no
  # SUBMITTING THE FORM BY CLICKING THE BUTTON
  - click: submitbutton
              

Next, we'll learn how to work with the register and what commands you can use to manipulate it.