예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
예제 #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)
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)
예제 #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)
예제 #17
0
def no_element_with_xpath(step):
    driver = world.browser
    xpath = step.multiline
    assert_false(step, is_element_present(driver, By.XPATH, xpath))
예제 #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)