Exemple #1
0
    def _this_step(step, handler_pick, drag_handler_pattern, target_pick,
                   drag_target_pattern):
        handler = _get_visible_element(finder_function_from, handler_pick,
                                       drag_handler_pattern)
        target = _get_visible_element(finder_function_to, target_pick,
                                      drag_target_pattern)

        handler.drag_and_drop(target)
Exemple #2
0
def assert_element_exists_with_negate(negate, text, partial, function):
    infix = "partial_" if partial else ""
    found = True
    try:
        _get_visible_element(function % (infix, ), None, text)
    except (ElementDoesNotExist, ElementIsNotVisible,
            ElementAtIndexDoesNotExist):
        found = False
    assert_with_negate(found, negate)
    return True
Exemple #3
0
    def _this_step(step, handler_pick, drag_handler_pattern, target_pick,
                   drag_target_pattern):
        handler = _get_visible_element(finder_function_from, handler_pick,
                                       drag_handler_pattern)
        target = _get_visible_element(finder_function_to, target_pick,
                                      drag_target_pattern)

        action_chain = ActionChains(world.browser.driver)
        action_chain.drag_and_drop(handler, target)
        action_chain.perform()
Exemple #4
0
    def _this_step(step, handler_pick, drag_handler_pattern, target_pick,
                   drag_target_pattern):
        handler = _get_visible_element(finder_function_from, handler_pick,
                                       drag_handler_pattern)
        target = _get_visible_element(finder_function_to, target_pick,
                                      drag_target_pattern)

        action_chain = ActionChains(world.browser.driver)
        action_chain.drag_and_drop(handler, target)
        action_chain.perform()
Exemple #5
0
def assert_element_exists_with_negate(negate, text, partial, function):
    infix = "partial_" if partial else ""
    found = True
    try:
        _get_visible_element(function % (infix, ), None, text)
    except (ElementDoesNotExist, ElementIsNotVisible,
            ElementAtIndexDoesNotExist):
        found = False
    assert_with_negate(found, negate)
    return True
Exemple #6
0
    def _drag_page_el_2_thing(step, element_name, pick, find_pattern):
        src = get_visible_page_element(element_name)
        target = _get_visible_element(finder_function, pick, find_pattern)

        action_chain = ActionChains(world.browser.driver)
        action_chain.drag_and_drop(src, target)
        action_chain.perform()
Exemple #7
0
 def check_element(self, finder_function, negate, pick,
                             find_pattern, wait_time, *args):
     try:
         element = _get_visible_element(finder_function, pick, find_pattern)
     except (ElementDoesNotExist, StaleElementReferenceException):
         assert parsed_negator(negate)
         element = None
     self.test(element, negate, *args)
     return True
Exemple #8
0
 def check_element(self, finder_function, negate, pick,
                             find_pattern, wait_time, *args):
     try:
         element = _get_visible_element(finder_function, pick, find_pattern)
     except ElementDoesNotExist:
         assert parsed_negator(negate)
         element = None
     self.test(element, negate, *args)
     return True
Exemple #9
0
def _get_attribute_of_element(finder_function, pick, find_pattern, attribute):
    ele = _get_visible_element(finder_function, pick, find_pattern)
    if attribute == 'text':
        return ele.text
    elif attribute == 'outer html':
        return ele.get_attribute('outerHTML')
    elif attribute == 'html':
        return ele.get_attribute('innerHTML')
    else:
        return ele.get_attribute(attribute)
Exemple #10
0
        def _this_step(step, named_or_with_value, field_value, pick, find_pattern):
            ele = _get_visible_element(finder_function, pick, find_pattern)
            if (named_or_with_value == "named"):
                # this does not work properly, it will click the first match
                # to field_value by default. it does not select the element we
                # are actually looking for.
                option = world.browser.find_option_by_text(field_value)
            else:
                option = ele.find_by_value(field_value)

            option.click()
Exemple #11
0
        def _this_step(step, named_or_with_value, field_value, pick,
                       find_pattern):
            ele = _get_visible_element(finder_function, pick, find_pattern)
            if (named_or_with_value == "named"):
                # this does not work properly, it will click the first match
                # to field_value by default. it does not select the element we
                # are actually looking for.
                option = world.browser.find_option_by_text(field_value)
            else:
                option = ele.find_by_value(field_value)

            option.click()
Exemple #12
0
    def _this_step(step, pick, find_pattern):
        ele = _get_visible_element(finder_function, pick, find_pattern)

        if action_function == 'click':
            ele.click()
            return

        action_chain = ActionChains(world.browser.driver)
        function = getattr(action_chain, ACTION_ASSOCIATIONS[action_function])
        if action_function == 'mouse_out':
            function(5000, 5000)
        else:
            function(ele)
        action_chain.perform()
Exemple #13
0
    def _this_step(step, pick, find_pattern):
        ele = _get_visible_element(finder_function, pick, find_pattern)

        if action_function == 'click':
            ele.click()
            return

        action_chain = ActionChains(world.browser.driver)
        function = getattr(action_chain, ACTION_ASSOCIATIONS[action_function])
        if action_function == 'mouse_out':
            function(5000, 5000)
        else:
            function(ele)
        action_chain.perform()
Exemple #14
0
 def _select_function(step, negate, by_what, stored, value, pick,
                      find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     select = Select(ele)
     # get value from storage if necessary
     if stored:
         value = world.stored_values[value]
     # adjust variables for proper Select usage
     if by_what == 'text':
         by_what = 'visible_text'
     elif by_what == 'index':
         value = int(value)
     # select or deselect according to negate
     attribute_mask = 'deselect_by_%s' if negate else 'select_by_%s'
     # get the method
     select_method = getattr(select, attribute_mask % (by_what, ))
     # select the correct option
     select_method(value)
Exemple #15
0
 def _this_step(step, pick, find_pattern, text):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     try:
         ele.value = text
     except:
         ele._control.value = text
Exemple #16
0
 def _this_step(step, slowly, text, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     if slowly and slowly != "":
         _type_slowly(ele, text)
     else:
         ele.value = text
Exemple #17
0
 def _deselect_function(step, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     select = Select(ele)
     select.deselect_all()
Exemple #18
0
 def _this_step(step, slowly, text, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     if slowly and slowly != "":
         _type_slowly(ele, text)
     else:
         ele.value = text
Exemple #19
0
 def _this_step(step, key_string, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     key = transform_key_string(key_string)
     ele.type(key)
Exemple #20
0
 def _this_step(step, negate, attribute, pick, find_pattern, value):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute), value, negate)
Exemple #21
0
 def _this_step(step, file_name, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.value = file_name
Exemple #22
0
 def _this_step(step, pick, find_pattern, text):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     try:
         ele.value = text
     except:
         ele._control.value = text
Exemple #23
0
    def _this_step(step, pick, find_pattern):
        ele = _get_visible_element(finder_function, pick, find_pattern)

        ele.__getattribute__(action_function)()
Exemple #24
0
 def _this_step(step, pick, find_pattern, text):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     _fill_in_text(ele, text)
Exemple #25
0
 def _this_step(step, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert (world.stored_values[name])
     ele.value = world.stored_values[name]
Exemple #26
0
    def _this_step(step, handler_pick, drag_handler_pattern, target_pick, drag_target_pattern):
        handler = _get_visible_element(finder_function_from, handler_pick, drag_handler_pattern)
        target = _get_visible_element(finder_function_to, target_pick, drag_target_pattern)

        handler.drag_and_drop(target)
Exemple #27
0
 def _this_step(step, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.blur()
Exemple #28
0
 def _this_step(step, negate, attribute, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute),
                               world.stored_values[name], negate)
Exemple #29
0
 def _this_step(step, negate, attribute, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute),
                               world.stored_values[name],
                               negate)
Exemple #30
0
 def _this_step(step, key_string, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     key = transform_key_string(key_string)
     ele.type(key)
Exemple #31
0
 def _this_step(step, what, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     value = getattr(ele, what)
     world.stored_values[name] = value
Exemple #32
0
 def _this_step(step, what, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     value = getattr(ele, what)
     world.stored_values[name] = value
Exemple #33
0
 def _this_step(step, file_name, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.value = file_name
Exemple #34
0
 def _this_step(step, pick, find_pattern):
     # make sure the element is visible anyway
     ele = _get_visible_element(finder_function, pick, find_pattern)
     # then click on the body of the html document
     ele = _get_visible_element('find_by_tag', None, "body")
     ele.click()
Exemple #35
0
 def _this_step(step, pick, find_pattern, name):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert(world.stored_values[name])
     ele.value = world.stored_values[name]
Exemple #36
0
 def _this_step(step, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.blur()
Exemple #37
0
 def _this_step(step, negate, attribute, pick, find_pattern, value):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     assert_equals_with_negate(getattr(ele, attribute), value, negate)
Exemple #38
0
    def _this_step(step, pick, find_pattern):
        ele = _get_visible_element(finder_function, pick, find_pattern)

        ele.__getattribute__(action_function)()