Exemplo n.º 1
0
def input_has_value(step, field_name, value):
    """
    Check that the form input element has given value.
    """
    with AssertContextManager(step):
        text_field = find_any_field(world.browser, DATE_FIELDS + TEXT_FIELDS, field_name)
        assert_false(step, text_field is False, 'Can not find a field named "%s"' % field_name)
        assert_equals(text_field.get_attribute("value"), value)
Exemplo n.º 2
0
def fill_in_textfield(step, field_name, value):
    with AssertContextManager(step):
        text_field = find_field(world.browser, 'text', field_name) or \
            find_field(world.browser, 'textarea', field_name) or \
            find_field(world.browser, 'password', field_name)
        assert_false(step, text_field == False,'Can not find a field named "%s"' % field_name)
        text_field.clear()
        text_field.send_keys(value)
Exemplo n.º 3
0
def fill_in_textfield(step, field_name, value):
    with AssertContextManager(step):
        text_field = find_field(world.browser, 'text', field_name) or \
            find_field(world.browser, 'textarea', field_name) or \
            find_field(world.browser, 'password', field_name)
        assert_false(step, text_field is False,
                     'Can not find a field named "%s"' % field_name)
        text_field.clear()
        text_field.send_keys(value)
Exemplo n.º 4
0
def element_not_focused(step, id):
    """
    Check if the element is not focused
    """

    elem = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
    focused = world.browser.switch_to_active_element()

    assert_false(step, elem == focused)
Exemplo n.º 5
0
def element_not_focused(step, id):
    """
    Check if the element is not focused
    """

    elem = world.browser.find_element_by_xpath(str('id("{id}")'.format(id=id)))
    focused = world.browser.switch_to_active_element()

    assert_false(step, elem == focused)
Exemplo n.º 6
0
def input_has_value(step, field_name, value):
    """
    Check that the form input element has given value.
    """
    with AssertContextManager(step):
        text_field = find_any_field(world.browser, DATE_FIELDS + TEXT_FIELDS,
                                    field_name)
        assert_false(step, text_field is False,
                     'Can not find a field named "%s"' % field_name)
        assert_equals(text_field.get_attribute('value'), value)
Exemplo n.º 7
0
def input_has_value(step, field_name, value):
    """
    Check that the form input element has given value.
    """
    with AssertContextManager(step):
        text_field = find_field(world.browser, 'text', field_name) or \
            find_field(world.browser, 'textarea', field_name) or \
            find_field(world.browser, 'password', field_name)
        assert_false(step, text_field is False,
                     'Can not find a field named "%s"' % field_name)
        assert_equals(text_field.get_attribute('value'), value)
Exemplo n.º 8
0
def input_has_value(step, field_name, value):
    """
    Check that the form input element has given value.
    """
    with AssertContextManager(step):
        text_field = find_field(world.browser, 'text', field_name) or \
            find_field(world.browser, 'textarea', field_name) or \
            find_field(world.browser, 'password', field_name)
        assert_false(step, text_field is False,
                     'Can not find a field named "%s"' % field_name)
        assert_equals(text_field.get_attribute('value'), value)
Exemplo n.º 9
0
def fill_in_textfield(step, field_name, value):
    with AssertContextManager(step):
        text_field = find_field(world.browser, 'text', field_name) or \
            find_field(world.browser, 'textarea', field_name) or \
            find_field(world.browser, 'password', field_name) or \
            find_field(world.browser, 'datetime', field_name) or \
            find_field(world.browser, 'datetime-local', field_name) or \
            find_field(world.browser, 'date', field_name) or \
            find_field(world.browser, 'month', field_name) or \
            find_field(world.browser, 'time', field_name) or \
            find_field(world.browser, 'week', field_name) or \
            find_field(world.browser, 'number', field_name) or \
            find_field(world.browser, 'range', field_name) or \
            find_field(world.browser, 'email', field_name) or \
            find_field(world.browser, 'url', field_name) or \
            find_field(world.browser, 'search', field_name) or \
            find_field(world.browser, 'tel', field_name) or \
            find_field(world.browser, 'color', field_name)
        assert_false(step, text_field is False,'Can not find a field named "%s"' % field_name)
        text_field.clear()
        text_field.send_keys(value)
Exemplo n.º 10
0
def fill_in_textfield(step, field_name, value):
    with AssertContextManager(step):
        text_field = find_field(world.browser, 'text', field_name) or \
            find_field(world.browser, 'textarea', field_name) or \
            find_field(world.browser, 'password', field_name) or \
            find_field(world.browser, 'datetime', field_name) or \
            find_field(world.browser, 'datetime-local', field_name) or \
            find_field(world.browser, 'date', field_name) or \
            find_field(world.browser, 'month', field_name) or \
            find_field(world.browser, 'time', field_name) or \
            find_field(world.browser, 'week', field_name) or \
            find_field(world.browser, 'number', field_name) or \
            find_field(world.browser, 'range', field_name) or \
            find_field(world.browser, 'email', field_name) or \
            find_field(world.browser, 'url', field_name) or \
            find_field(world.browser, 'search', field_name) or \
            find_field(world.browser, 'tel', field_name) or \
            find_field(world.browser, 'color', field_name)
        assert_false(step, text_field is False,
                     'Can not find a field named "%s"' % field_name)
        text_field.clear()
        text_field.send_keys(value)
Exemplo n.º 11
0
def fill_in_textfield(step, field_name, value):
    with AssertContextManager(step):
        text_field = (
            find_field(world.browser, "text", field_name)
            or find_field(world.browser, "textarea", field_name)
            or find_field(world.browser, "password", field_name)
            or find_field(world.browser, "datetime", field_name)
            or find_field(world.browser, "datetime-local", field_name)
            or find_field(world.browser, "date", field_name)
            or find_field(world.browser, "month", field_name)
            or find_field(world.browser, "time", field_name)
            or find_field(world.browser, "week", field_name)
            or find_field(world.browser, "number", field_name)
            or find_field(world.browser, "range", field_name)
            or find_field(world.browser, "email", field_name)
            or find_field(world.browser, "url", field_name)
            or find_field(world.browser, "search", field_name)
            or find_field(world.browser, "tel", field_name)
            or find_field(world.browser, "color", field_name)
        )
        assert_false(step, text_field is False, 'Can not find a field named "%s"' % field_name)
        text_field.clear()
        text_field.send_keys(value)
Exemplo n.º 12
0
def fill_in_textfield_by_class(step, field_name, value):
    with AssertContextManager(step):
        text_field = find_field_by_class(world.browser, field_name)
        assert_false(step, text_field is False,'Can not find a field named "%s"' % field_name)
        text_field.clear()
        text_field.send_keys(value)
Exemplo n.º 13
0
def reorder_column_by_offset(step, css, index, rightOrLeft, offsetx):
    with AssertContextManager(step):
        originalHeaderName = get_column_header_name(world.browser, css, index)
        reorder_column_with_offset(world.browser, css, index, rightOrLeft, offsetx)
        changedHeaderName = get_column_header_name(world.browser, css, index)
        assert_false(step, str(originalHeaderName) == str(changedHeaderName))
def check_element_by_selector(step, selector):
    elems = find_elements_by_jquery(world.browser, selector)
    assert_false(step, elems)
def check_element_by_selector(step, selector):
    elems = find_elements_by_jquery(world.browser, selector)
    assert_false(step, elems)
Exemplo n.º 16
0
def element_not_contains(step, element_id, value):
    elem = world.browser.find_elements_by_xpath(
        str('id("{id}")[contains(text(), "{value}")]'.format(id=element_id,
                                                             value=value)))
    assert_false(step, elem)
Exemplo n.º 17
0
def no_element_with_xpath(step):
    driver = world.browser
    xpath = step.multiline
    assert_false(step, is_element_present(driver, By.XPATH, xpath))
Exemplo n.º 18
0
def element_not_contains(step, element_id, value):
    elem = world.browser.find_elements_by_xpath(
        str('id("{id}")[contains(., "{value}")]'.format(id=element_id, value=value))
    )
    assert_false(step, elem)