コード例 #1
0
def header_menu_button_style(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, data_table):
    xpath = locators.parse_and_get(locator_path)
    selenium_generics.validate_element_style(xpath, data_table)
コード例 #2
0
def check_css_property_is_not(attribute, selenium_generics: SeleniumGenerics, locators: Locators, locator_path, value):
    actual_value = selenium_generics.get_css_attribute_of_element(locators.parse_and_get(locator_path), attribute)
    assert_that(actual_value).is_not_equal_to(value)
コード例 #3
0
def element_not_exists(selenium, locators: Locators, locator_path):
    CustomWait(selenium).wait_for_element_not_visible(value=locators.parse_and_get(locator_path))
コード例 #4
0
def set_add_element_value(selenium, locators: Locators, locator_path):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    element.clear()
コード例 #5
0
def does_not_contain_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, text):
    actual_text = selenium_generics.get_text_from_element(locators.parse_and_get(locator_path))
    assert_that(actual_text).does_not_contain(text)
コード例 #6
0
def dbl_click_element(selenium, locators: Locators, locator_path):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    ActionChains(selenium).double_click(element).perform()
コード例 #7
0
def add_element_value(selenium, text, locators: Locators, locator_path):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    actual_text = element.get_attribute('value')
    element.send_keys(actual_text + text)
コード例 #8
0
def element_not_displayed(selenium, locators: Locators, locator_path):
    assert_that(selenium.find_element(By.XPATH, locators.parse_and_get(locator_path)).is_displayed()).is_false()
コード例 #9
0
def wait_for_displayed(selenium, locators: Locators, locator_path):
    CustomWait(selenium).wait_for_element_visible(value=locators.parse_and_get(locator_path))
コード例 #10
0
def check_element_enabled(selenium, locators: Locators, locator_path):
    locator = locators.parse_and_get(locator_path)
    CustomWait(selenium).wait_for_element_visible(value=locator)
    assert_that(selenium.find_element(By.XPATH, locator).is_enabled()).is_true()
コード例 #11
0
def check_element_not_exists(selenium, locators: Locators, locator_path, occurrence_count):
    locator = locators.parse_and_get(locator_path)
    assert_that(selenium.find_elements(By.XPATH, locator).__len__()).is_not_equal_to(occurrence_count)
コード例 #12
0
def hover_over_shadow_element(selenium_generics: SeleniumGenerics, locators: Locators, element_path):
    parent_xpath = locators.parse_and_get(element_path['parent_xpath'])
    locator_paths = [ locators.parse_and_get(path) for path in element_path['shadow_path'].split(' ~ ') ]
    selenium_generics.shadow_hover(parent_xpath, *locator_paths)
コード例 #13
0
def hover_over_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path):
    xpath = locators.parse_and_get(locator_path)
    selenium_generics.scroll_into_view(selector=xpath)
    selenium_generics.hover(selector=xpath)
コード例 #14
0
def click_on_element(selenium_generics: SeleniumGenerics, locators: Locators, locator_path):
    xpath = locators.parse_and_get(locator_path)
    selenium_generics.scroll_into_view(selector=xpath)
    selenium_generics.click(selector=xpath)
コード例 #15
0
def move_to_element_by_offset(selenium, locators: Locators, locator_path, x, y):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    ActionChains(selenium).move_to_element_with_offset(element, int(x), int(y))
コード例 #16
0
def check_within_viewport(selenium, locators: Locators, locator_path):
    assert_that(selenium.find_element(By.XPATH, locators.parse_and_get(locator_path)).is_in_viewport()).is_false()
コード例 #17
0
def click_element(selenium, locators: Locators, locator_path):
    selenium.find_element(By.XPATH, locators.parse_and_get(locator_path)).click()
コード例 #18
0
def check_is_existing(selenium, locators: Locators, locator_path):
    CustomWait(selenium).wait_for_element_present(value=locators.parse_and_get(locator_path))
コード例 #19
0
def js_click_element(selenium, locators: Locators, locator_path):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    selenium.execute_script('arguments[0].click();', element)
コード例 #20
0
def check_does_not_contain_same_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_path1, locator_path2):
    actual_text1 = selenium_generics.get_text_from_element(locators.parse_and_get(locator_path1))
    actual_text2 = selenium_generics.get_text_from_element(locators.parse_and_get(locator_path2))
    assert_that(actual_text1).is_not_equal_to(actual_text2)
コード例 #21
0
def set_element_value(selenium, text, locators: Locators, locator_path):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    element.send_keys(text)
コード例 #22
0
def scroll_to_element(selenium, locators: Locators, locator_path):
    element = selenium.find_element(By.XPATH, locators.parse_and_get(locator_path))
    script = 'arguments[0].scrollIntoView({block: "center", inline: "center"})'
    selenium.execute_script(script, element)
コード例 #23
0
def drag_and_drop_element(selenium, locators: Locators, source, target):
    source_elem = selenium.find_element(By.XPATH, locators.parse_and_get(source))
    target_elem = selenium.find_element(By.XPATH, locators.parse_and_get(target))

    action = ActionChains(selenium)
    action.drag_and_drop(source_elem, target_elem).perform()
コード例 #24
0
def select_option_by_value(selenium, option, locators: Locators, locator_path):
    select = Select(selenium.find_element(By.XPATH, locators.parse_and_get(locator_path)))
    select.select_by_value(option)
コード例 #25
0
def contains_any_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_path):
    actual_text = selenium_generics.get_text_from_element(locators.parse_and_get(locator_path))
    assert_that(actual_text).matches(r'(.*?)')
コード例 #26
0
def deselect_option_index(selenium, index: int, locators: Locators, locator_path):
    select = Select(selenium.find_element(By.XPATH, locators.parse_and_get(locator_path)))
    select.deselect_by_index(index)
コード例 #27
0
def element_not_selected(selenium, locators: Locators, locator_path):
    locator = locators.parse_and_get(locator_path)
    CustomWait(selenium).wait_for_element_visible(value=locator)
    assert_that(selenium.find_element(By.XPATH, locator).is_selected()).is_false()
コード例 #28
0
def deselect_option_by_visible_text(selenium, option, locators: Locators, locator_path):
    select = Select(selenium.find_element(By.XPATH, locators.parse_and_get(locator_path)))
    select.deselect_by_visible_text(option)
コード例 #29
0
def element_not_equals_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, text):
    actual_text = selenium_generics.get_text_from_element(locators.parse_and_get(locator_path))
    assert_that(actual_text).is_not_equal_to(text)
コード例 #30
0
def element_text(selenium_generics: SeleniumGenerics, locators: Locators, locator_path, expected_text):
    xpath = locators.parse_and_get(locator_path)
    selenium_generics.validate_element_text(xpath, expected_text)