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)
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
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()
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()
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
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()
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
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
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)
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()
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()
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()
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()
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)
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
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
def _deselect_function(step, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) select = Select(ele) select.deselect_all()
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
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)
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)
def _this_step(step, file_name, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) ele.value = file_name
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
def _this_step(step, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) ele.__getattribute__(action_function)()
def _this_step(step, pick, find_pattern, text): ele = _get_visible_element(finder_function, pick, find_pattern) _fill_in_text(ele, text)
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]
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)
def _this_step(step, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) ele.blur()
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)
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)
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)
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
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
def _this_step(step, file_name, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) ele.value = file_name
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()
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]
def _this_step(step, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) ele.blur()
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)
def _this_step(step, pick, find_pattern): ele = _get_visible_element(finder_function, pick, find_pattern) ele.__getattribute__(action_function)()