Ejemplo n.º 1
0
Archivo: mouse.py Proyecto: salad/salad
    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)
Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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
Ejemplo n.º 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()
Ejemplo n.º 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
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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()
Ejemplo n.º 11
0
Archivo: forms.py Proyecto: salad/salad
        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()
Ejemplo n.º 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()
Ejemplo n.º 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()
Ejemplo n.º 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)
Ejemplo n.º 15
0
Archivo: forms.py Proyecto: salad/salad
 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
Ejemplo n.º 16
0
Archivo: forms.py Proyecto: salad/salad
 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
Ejemplo n.º 17
0
 def _deselect_function(step, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     select = Select(ele)
     select.deselect_all()
Ejemplo n.º 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
Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 21
0
 def _this_step(step, file_name, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.value = file_name
Ejemplo n.º 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
Ejemplo n.º 23
0
Archivo: mouse.py Proyecto: salad/salad
    def _this_step(step, pick, find_pattern):
        ele = _get_visible_element(finder_function, pick, find_pattern)

        ele.__getattribute__(action_function)()
Ejemplo n.º 24
0
 def _this_step(step, pick, find_pattern, text):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     _fill_in_text(ele, text)
Ejemplo n.º 25
0
Archivo: forms.py Proyecto: salad/salad
 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]
Ejemplo n.º 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)
Ejemplo n.º 27
0
 def _this_step(step, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.blur()
Ejemplo n.º 28
0
Archivo: forms.py Proyecto: salad/salad
 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)
Ejemplo n.º 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)
Ejemplo n.º 30
0
Archivo: forms.py Proyecto: salad/salad
 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)
Ejemplo n.º 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
Ejemplo n.º 32
0
Archivo: forms.py Proyecto: salad/salad
 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
Ejemplo n.º 33
0
Archivo: forms.py Proyecto: salad/salad
 def _this_step(step, file_name, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.value = file_name
Ejemplo n.º 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()
Ejemplo n.º 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]
Ejemplo n.º 36
0
Archivo: forms.py Proyecto: salad/salad
 def _this_step(step, pick, find_pattern):
     ele = _get_visible_element(finder_function, pick, find_pattern)
     ele.blur()
Ejemplo n.º 37
0
Archivo: forms.py Proyecto: salad/salad
 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)
Ejemplo n.º 38
0
    def _this_step(step, pick, find_pattern):
        ele = _get_visible_element(finder_function, pick, find_pattern)

        ele.__getattribute__(action_function)()