Exemplo n.º 1
0
def fill_in_textfield(self, field_name, value):
    """
    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.
    """

    date_field = find_any_field(world.browser,
                                DATE_FIELDS,
                                field_name)
    if date_field:
        field = date_field
    else:
        field = find_any_field(world.browser,
                               TEXT_FIELDS,
                               field_name)

    assert_true(field,
                "Cannot find a field named '{}'.".format(field_name))

    if date_field:
        field.send_keys(Keys.DELETE)
    else:
        field.clear()

    field.send_keys(value)
Exemplo n.º 2
0
def fill_in_textfield(self, field_name, value):
    """
    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.
    """

    date_field = find_any_field(world.browser, DATE_FIELDS, field_name)
    if date_field:
        field = date_field
    else:
        field = find_any_field(world.browser, TEXT_FIELDS, field_name)

    if not field:
        raise AssertionError(
            "Cannot find a field named '{}'.".format(field_name))

    if date_field:
        field.send_keys(Keys.DELETE)
    else:
        field.clear()

    field.send_keys(value)
Exemplo n.º 3
0
def fill_in_textfield(self, field_name, value):
    date_field = find_any_field(world.browser, DATE_FIELDS, field_name)
    if date_field:
        field = date_field
    else:
        field = find_any_field(world.browser, TEXT_FIELDS, field_name)

    assert_true(field, 'Can not find a field named "%s"' % field_name)
    if date_field:
        field.send_keys(Keys.DELETE)
    else:
        field.clear()
    field.send_keys(value)
Exemplo n.º 4
0
def fill_in_textfield(self, field_name, value):
    date_field = find_any_field(world.browser,
                                DATE_FIELDS,
                                field_name)
    if date_field:
        field = date_field
    else:
        field = find_any_field(world.browser,
                               TEXT_FIELDS,
                               field_name)

    assert_true(field,
                'Can not find a field named "%s"' % field_name)
    if date_field:
        field.send_keys(Keys.DELETE)
    else:
        field.clear()
    field.send_keys(value)
Exemplo n.º 5
0
def input_has_value(self, field_name, value):
    """
    Check that the form input element has given value.
    """
    text_field = find_any_field(world.browser, DATE_FIELDS + TEXT_FIELDS,
                                field_name)
    assert_false(text_field is False,
                 'Can not find a field named "%s"' % field_name)
    assert_equal(text_field.get_attribute('value'), value)
Exemplo n.º 6
0
def input_has_value(self, field_name, value):
    """
    Assert the form input with label (recommended), name or id has given value.
    """
    text_field = find_any_field(world.browser,
                                DATE_FIELDS + TEXT_FIELDS,
                                field_name)
    assert_false(text_field is False,
                 'Can not find a field named "%s"' % field_name)
    assert_equal(text_field.get_attribute('value'), value)
Exemplo n.º 7
0
def input_has_value(self, field_name, value):
    """
    Check that the form input element has given value.
    """
    text_field = find_any_field(world.browser,
                                DATE_FIELDS + TEXT_FIELDS,
                                field_name)
    assert_false(text_field is False,
                 'Can not find a field named "%s"' % field_name)
    assert_equal(text_field.get_attribute('value'), value)
Exemplo n.º 8
0
def input_has_value(self, field_name, value):
    """
    Assert the form input with label (recommended), name or id has given value.
    """
    text_field = find_any_field(world.browser, DATE_FIELDS + TEXT_FIELDS,
                                field_name)
    if text_field is False:
        raise AssertionError(
            "Can not find a field named {!r}.".format(field_name))

    actual = text_field.get_attribute('value')
    if actual != value:
        raise AssertionError(
            "Field value expected to be {!r}, got {!r}.".format(value, actual))
Exemplo n.º 9
0
def input_has_value(self, field_name, value):
    """
    Assert the form input with label (recommended), name or id has given value.
    """
    text_field = find_any_field(world.browser,
                                DATE_FIELDS + TEXT_FIELDS,
                                field_name)
    if text_field is False:
        raise AssertionError(
            "Can not find a field named {!r}.".format(field_name))

    actual = text_field.get_attribute('value')
    if actual != value:
        raise AssertionError(
            "Field value expected to be {!r}, got {!r}.".format(
                value, actual))
Exemplo n.º 10
0
def fill_bootstrap_field(step, text, id_field):
    date_field = find_any_field(world.browser, TEXT_FIELDS, id_field)
    date_field.send_keys(text)
Exemplo n.º 11
0
def fill_bootstrap_field(step, text, field):
    words_list = field.lower().split()
    words_list.insert(0, "id")
    id_field = "_".join(words_list)
    date_field = find_any_field(world.browser, TEXT_FIELDS, id_field)
    date_field.send_keys(text)