Beispiel #1
0
def present(context, loc_type, loc_value, present_token):
    should_exist = False if present_token == "not" else True
    try:
        loc_value = context.lookup(loc_value)
        locate_element(context, loc_type, loc_value)
    except NoSuchElementException:
        if not should_exist:
            return True
    else:  # element is present
        if should_exist:
            return True
    raise Exception("Element present exception")
Beispiel #2
0
def assert_elem_text(context, loc_type, loc_value, present, partial, value):
    value = context.lookup(value)
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    present_check = False if present == "not" else True
    partial_check = True if partial == "partial" else False
    assertions.assert_text(elem, partial_check, value, present_check)
Beispiel #3
0
def assert_attr(context, loc_type, loc_value, present, attr_name, seconds,
                condition):
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    present_check = False if present == "not" else True
    seconds = int(seconds)
    loc_value = context.lookup(loc_value)
    wait.element(context, loc_type, loc_value, condition, seconds)
Beispiel #4
0
def assert_attr(context, loc_type, loc_value, present, attr_name, attr_value):
    attr_value = context.lookup(attr_value)
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    print(" elem ====", elem)
    present_check = False if present == "not" else True
    print(" attr_name ====", attr_name)
    print(" attr_value ====", attr_value)
    print(" present_check ====", present_check)
Beispiel #5
0
def hover(context, loc_type, loc_value):
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    nav.hover_over(context, elem)
Beispiel #6
0
def clear_input(context, loc_type, loc_value):
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    input.clear(elem)
Beispiel #7
0
def assert_enabled(context, loc_type, loc_value, loc_state):
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    assertions.assert_enabled(elem, loc_state)
Beispiel #8
0
def scroll(context, loc_type, loc_value):
    loc_value = context.lookup(loc_value)
    elem = locate_element(context, loc_type, loc_value)
    nav.scroll_to(elem)