def evaluate_the_javascript(step, negate, script, value): try: assert_equals_with_negate("%s" % world.browser.evaluate_script(script), value, negate) except NotImplementedError: logger.info( "Attempted to run javascript in a javascript-disabled browser. Moving along." )
def assert_javascript_returns_value(negate, script, value): try: assert_equals_with_negate( "%s" % world.browser.evaluate_script(script), value, negate) except NotImplementedError: logger.info("Attempted to run javascript in a javascript-disabled" "browser. Moving along.") return True
def attribute_value_test(element, negate, *args): attribute = args[0] value = args[1] assert_equals_with_negate(element.get_attribute(attribute), value, negate)
def _this_step(step, negate, first, last, find_pattern, attr_name, attr_value): ele = _get_element(finder_function, first, last, find_pattern) assert_equals_with_negate("%s" % ele[attr_name], attr_value, negate)
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 assert_url_equals(negate, partial, url): if partial == 'is': assert_equals_with_negate(world.browser.url, url, negate) else: assert_with_negate(url in world.browser.url, negate) return True
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 attribute_value_test(element, negate, *args): attribute = args[0] value = args[1] assert_equals_with_negate(element[attribute], value, negate)
def contains_exactly_test(element, negate, *args): content = args[0] text = getattr(element, 'text', None) assert_equals_with_negate(content, text, negate)
def should_be_titled(step, negate, title): assert_equals_with_negate(world.browser.title, title, negate)
def should_have_html(step, negate, html): assert_equals_with_negate(world.browser.html, html, negate)
def should_have_the_url(step, negate, url): assert_equals_with_negate(world.browser.url, url, negate)
def _this_step(step, first, last, find_pattern, negate, value): ele = _get_element(finder_function, first, last, find_pattern) assert_equals_with_negate(ele.value, value, negate)
def _this_step(step, negate, first, last, find_pattern, content): ele = _get_element(finder_function, first, last, find_pattern) assert_equals_with_negate(ele.text, content, negate)
def assert_title_equals(negate, partial, title): if 'contains' in partial: assert_with_negate(title in world.browser.title, negate) else: assert_equals_with_negate(world.browser.title, title, negate) return True
def assert_page_html_is(negate, partial, html): if partial == 'is': assert_equals_with_negate(world.browser.html, html, negate) else: assert_with_negate(html in world.browser.html, negate) return True