zoukankan      html  css  js  c++  java
  • 读取config的文件

    from selenium.webdriver import ActionChains
    from selenium.webdriver.common.by import By
    
    from ui.helpers import assertions as assr
    from steps.ui.common_steps import *
    from ui.helpers import utils as utils
    from lib import parsers
    from steps.ui.common_steps import *
    from steps.ui.lsh.locators.lsh_locator import LSHLocators
    
    
    ###############
    # STEPS #
    ###############
    
    
    @given(parsers.parse('I navigate from top menu "{top_menu}" to "{sub_menu}" module'))
    def navigate_to_module(driver, top_menu, sub_menu):
        selector_top_menu = LSHLocators.LOC_SELECTOR_TOP_MENU_XPATH_FORMAT.format(top_menu)
        selector_sub_menu = LSHLocators.LOC_SELECTOR_SUB_MENU_XPATH_FORMAT.format(sub_menu)
        elem_top_menu = utils.find_element(driver, By.XPATH, selector_top_menu)
        elem_sub_menu = utils.find_element(driver, By.XPATH, selector_sub_menu)
        actions = ActionChains(driver)
        actions.move_to_element(elem_top_menu).perform()
        # utils.wait_for_window(1)
        elem_sub_menu.click()
        iframes = driver.find_elements_by_tag_name('iframe')
        driver.switch_to.frame(iframes[0])
        utils.wait_for_window()
    
    
    @then(parsers.parse('I verify the Module is opened with header "{header}"'))
    def verify_header(driver, header):
        # selector_header = LSHLocators.LOC_SELECTOR_HEADER_XPATH_FORMAT.format(header)
        assr.assert_text_present(driver, header, By.CSS_SELECTOR, LSHLocators.LOC_SELECTOR_HEADER_CLASS_CSS)
    
    
    @then(parsers.parse('I verify My Audiences Module is opened with header "{header}"'))
    def verify_module_open_with_header(driver, header):
        selector_header = LSHLocators.LOC_SELECTOR_HEADER_XPATH_FORMAT.format(header)
        assr.assert_text_present(driver, header, By.XPATH, selector_header)
    
    
    @given(parsers.parse('A fixture test step "{account_name}" "{account_name_sub01}"'))
    def fixture_test(driver, get_lsh_target_env_config, account_name, account_name_sub01):
        """A fixture test method"""
        print("------------------------")
        print(os.environ.get("PYTHON_ENV"))
        print(get_lsh_target_env_config.get('Mutual', account_name))
        print(get_lsh_target_env_config.get('Mutual', account_name_sub01, raw=0))
        print(get_lsh_target_env_config.get('Distribution', '1st.party.dataset.name', raw=0))
        print(get_lsh_target_env_config.get('Distribution', '1st.party.taxonomy.name', raw=0))
        print(get_lsh_target_env_config.get('Distribution', 'destination.name.default', raw=0))
        print("------------------------")
        assert False
    

      

    ------------------------- A little Progress a day makes you a big success... ----------------------------
  • 相关阅读:
    Activity 之使用
    Activity 之生命周期
    Activity 关于生命周期一些问题的实践验证
    深入理解Java虚拟机-第1章-走进Java-读书笔记
    代码整洁之道-第11章-系统-读书笔记
    代码整洁之道-第10章-类-读书笔记
    代码整洁之道-第9章-单元测试-读书笔记
    代码整洁之道-第8章-边界-读书笔记
    代码整洁之道-第7章-错误处理-读书笔记
    华为交换机做端口流量统计
  • 原文地址:https://www.cnblogs.com/qianjinyan/p/14411022.html
Copyright © 2011-2022 走看看