Beispiel #1
0
def verify_text(text):
    _run_wait_hook()
    driver = get_driver()
    step_message = 'Verify \'{0}\' is present in page'.format(text)
    logger.logger.info(step_message)
    _capture_or_add_step(step_message, core.settings['screenshot_on_step'])
    if text not in driver.page_source:
        raise TextNotPresent(
            "Text '{}' was not found in the page".format(text))
Beispiel #2
0
def verify_text_in_element(element, text):
    _run_wait_hook()
    webelement = get_driver().find(element)
    step_message = 'Verify element \'{0}\' contains text \'{1}\''.format(
        webelement.name, text)
    logger.logger.info(step_message)
    _capture_or_add_step(step_message, core.settings['screenshot_on_step'])
    if text not in webelement.text:
        raise TextNotPresent(
            "Text \'{0}\' was not found in element {1}".format(
                text, webelement.name))
Beispiel #3
0
def verify_selected_option(element, text):
    _run_wait_hook()
    webelement = get_driver().find(element)
    select = selenium.webdriver.support.select.Select(webelement)
    step_message = 'Verify selected option of element \'{0}\' is \'{1}\''.format(
        webelement.name, text)
    logger.logger.info(step_message)
    _capture_or_add_step(step_message, core.settings['screenshot_on_step'])
    if not select.first_selected_option.text == text:
        raise TextNotPresent('Option selected in element \'{0}\' '
                             'is not {1}'.format(webelement.name, text))
Beispiel #4
0
def verify_text(text):
    """Verify that the given text is present anywhere in the page.
    Parameters:
    text : value
    """
    _run_wait_hook()
    driver = browser.get_browser()
    step_message = 'Verify \'{0}\' is present in page'.format(text)
    execution.logger.info(step_message)
    _capture_or_add_step(step_message, execution.settings['screenshot_on_step'])
    if text not in driver.page_source:
        raise TextNotPresent("Text '{}' was not found in the page".format(text))
Beispiel #5
0
def verify_text_in_element(element, text):
    """Verify the given text is present in element.
    Parameters:
    element : element
    text : value
    """
    _run_wait_hook()
    webelement = browser.get_browser().find(element)
    step_message = 'Verify element \'{0}\' contains text \'{1}\''.format(webelement.name, text)
    execution.logger.info(step_message)
    _capture_or_add_step(step_message, execution.settings['screenshot_on_step'])
    if text not in webelement.text:
        raise TextNotPresent("Text \'{0}\' was not found in element {1}. Text \'{2}\' was found."
                             .format(text, webelement.name, webelement.text))
Beispiel #6
0
def verify_selected_option(element, text):
    """Verify an element has a selected option, passed by option text.
    Parameters:
    element : element
    text : value
    """
    _run_wait_hook()
    webelement = browser.get_browser().find(element)
    select = selenium.webdriver.support.select.Select(webelement)
    step_message = ('Verify selected option of element \'{0}\''
                    ' is \'{1}\''.format(webelement.name, text))
    execution.logger.info(step_message)
    _capture_or_add_step(step_message,
                         execution.settings['screenshot_on_step'])
    if not select.first_selected_option.text == text:
        raise TextNotPresent('Option selected in element \'{0}\' '
                             'is not {1}'.format(webelement.name, text))