Forms

import aloe_webdriver

Steps for referring to form controls typically support three methods to identify the control:

  1. The label of the control. This is the recommended way to refer to a control as it is the most descriptive.
  2. The control’s name. This can be used if you have multiple controls with the same label (i.e. in formsets).
  3. The control’s id.
Step I should see a form that goes to “([^”]*)”$

Assert the existence of a HTML form that submits to the given URL.

Step I click on label “([^”]*)”

Click on the given label.

On a correctly set up form this will highlight the appropriate field.

Step I submit the only form

Look for a form on the page and submit it.

Asserts if more than one form exists.

Step I submit the form with action “([^”]*)”

Submit the form with the given action URL (i.e. the form that submits to /post/my/data).

Text Fields

Step I fill in “([^”]*)” with “([^”]*)”$

Fill in the HTML input with given label (recommended), name or id with the given text.

Supported input types are text, textarea, password, month, time, week, number, range, email, url, tel and color.

Step Input “([^”]*)” (?:has|should have) value “([^”]*)”

Assert the form input with label (recommended), name or id has given value.

Buttons

Step I press “([^”]*)”$

Click the button with the given label.

Checkboxes

Step I check “([^”]*)”$

Check the checkbox with label (recommended), name or id.

Step I uncheck “([^”]*)”$

Uncheck the checkbox with label (recommended), name or id.

Step The “([^”]*)” checkbox should be checked$

Assert the checkbox with label (recommended), name or id is checked.

Step The “([^”]*)” checkbox should not be checked$

Assert the checkbox with label (recommended), name or id is not checked.

Radio Buttons

Step I choose “([^”]*)”$

Click (and choose) the radio button with the given label (recommended), name or id.

Step The “([^”]*)” option should be chosen$

Assert the radio button with the given label (recommended), name or id is chosen.

Step The “([^”]*)” option should not be chosen$

Assert the radio button with the given label (recommended), name or id is not chosen.

Selects (Comboboxes)

Step I select “([^”]*)” from “([^”]*)”$

Select the named option from select with label (recommended), name or id.

Step I select the following from “([^”]*?)”:?$

Select multiple options from select with label (recommended), name, or id. Pass a multiline string of options. e.g.

When I select the following from "Contact Methods":
    """
    Email
    Phone
    Fax
    """
Step The “([^”]*)” option from “([^”]*)” should be selected$

Assert the given option is selected from the select with label (recommended), name or id.

If multiple selections are supported other options may be selected.

Step The following options from “([^”]*?)” should be selected:?$
Step I should see option “([^”]*)” in selector “([^”]*)”

Assert the select contains the given option.

Step I should not see option “([^”]*)” in selector “([^”]*)”

Assert the select does not contain the given option.