Exemple #1
0
def login(useranme, password):
    '''封装的登录的函数'''
    driver = webdriver.Chrome(executable_path="d:\\chromedriver")
    driver.get("https://www.126.com")
    login_page = LoginPage.loginPage(driver)
    #login_page.click_login_link()
    login_page.switch_to_iframe()
    login_page.input_username(useranme)
    login_page.input_password(password)
    login_page.click_login_button()
    return driver
Exemple #2
0
        element = find_element(self.driver,
                               check_box.split(">")[0],
                               check_box.split(">")[1])
        return element

    def click_star_flag(self, flag):
        if flag is None: return
        if ("y" in flag) or ("yes" in flag) or ("是" in flag):
            check_box = self.get_star_flag()
            check_box.click()


if __name__ == "__main__":
    driver = webdriver.Chrome(executable_path="d:\\chromedriver")
    driver.get("https://www.126.com")
    login_page = LoginPage.loginPage(driver)
    login_page.click_login_link()
    login_page.switch_to_iframe()
    login_page.input_username("testgloryroad2020")
    login_page.input_password("123456789!!")
    login_page.click_login_button()

    home_page = HomePage.homePage(driver)
    home_page.click_address_link()

    address_page = addressPage(driver)
    address_page.click_create_button()
    address_page.input_name("吴老师")
    address_page.input_email("*****@*****.**")
    address_page.input_comment("随便写写")
    address_page.click_star_flag("是")