def loginSuccess(driver, username, password): try: driver.get(url) login = LoginPage(driver) # main = MainPage(driver) if username: login.userNameObj().send_keys(username) if password: login.passwordObj().send_keys(password) login.loginBtn().click() time.sleep(1) login.loginCon().click() time.sleep(1) # 判断是否进入住院收费处的页面url_zysf,是则增加一步 if driver.current_url == url_zysf: login.loginfirstSys().click() time.sleep(1) ActionChains(driver).double_click(login.loginSys()).perform() elif driver.current_url == url_hiszysf: # 鼠标双击新版His住院收费 ActionChains(driver).double_click(login.loginSys()).perform() # login.userNameObj().clear() # login.passwordObj().clear() # driver.quit() except Exception as e: raise e
def loginFail(driver, username, password): try: driver.get(url) login = LoginPage(driver) if username: login.userNameObj().send_keys(username) if password: login.passwordObj().send_keys(password) login.loginBtn().click() time.sleep(1) login.errorClose().click() login.userNameObj().clear() login.passwordObj().clear() # driver.quit() except Exception as e: raise e