Ejemplo n.º 1
0
 def quit(self):
     try:
         time.sleep(3)
         self.common_page.click_username()
         time.sleep(3)
         self.common_page.click_loginout_button()
         time.sleep(3)
         logger.info('账号退出登录成功')
     except Exception as e:
         logger.debug(e)
     return LoginPage(self.common_page.driver)
Ejemplo n.º 2
0
class LoginAction:
    def __init__(self, driver):
        self.login_page = LoginPage(driver)

    def login_action(self, username, password):
        time.sleep(3)
        self.login_page.input_username(username)
        time.sleep(3)
        self.login_page.input_password(password)
        time.sleep(3)
        self.login_page.click_login()
        logger.info('输入的账号是:%s,  密码是:%s' % (username, password))
        return CommonPage(self.login_page.driver)

    def login_success(self, username, password):
        self.login_action(username, password)

    def login_fail(self, username, password):
        self.login_action(username, password)
        # return self.login_page.get_login_fail_alert_content()

    #默认登录成功
    def default_login(self):
        self.login_action(local_config.username, local_config.password)
        logger.info('默认的账号,密码登录成功!')
        return CommonPage(self.login_page.driver)

        #扩展
    def login_by_cookie(self):
        pass
Ejemplo n.º 3
0
 def setUpClass(cls):
     cls.driver = webdriver.Firefox()
     cls.loginp = LoginPage(cls.driver)
     cls.driver.get(login_url)
Ejemplo n.º 4
0
 def __init__(self, driver):
     self.login_page = LoginPage(driver)