def login(self): u'''根据配置文件读取用户登录''' browser = BrowserEngine(self) self.driver = browser.open_browser(self) user_path = getcwd.get_cwd() + '/config/user_info.txt' loginpage = Login_logout(self.driver) user_file = open(user_path) all_values = user_file.readlines() values = all_values[0] user_file.close() username = values.split(',')[0] userpasswrod = values.split(',')[1] loginpage.login(username, userpasswrod) return self.driver
def test_login(self): u'''登录政务系统测试用例,用户名:admin''' user_path = getcwd.get_cwd() + '/config/user_info.txt' loginpage = Login_logout(self.driver) user_file = open(user_path) all_values = user_file.readlines() values = all_values[0] user_file.close() username = values.split(',')[0] userpasswrod = values.split(',')[1] loginpage.login(username, userpasswrod) try: title = loginpage.get_title() self.assertEqual('网上审批系统', title) except Exception as e: loginpage.get_windows_img() raise e
def setUpClass(cls): browser = BrowserEngine(cls) cls.driver = browser.open_browser(cls) login = Login_logout(cls.driver) login.login('admin', 'abc123456')