def test_1_login(self): self.login_page = Login(self.driver, self.url, self.title) self.login_page.open() self.login_page.click_on(("id", "lbNormal")) self.login_page.chage_frame() sleep(3) self.login_page.input_name(self.user_name) self.login_page.input_password(self.user_password) sleep(2) #login_page.save_img("测试报告") #截图 self.login_page.click_on(("id", "dologin")) sleep(2) self.login_page.add_img(self.imgs) print(self.login_page.get_login_message()) assert "网易邮箱6.0版" in self.login_page.get_login_message()
def sign_in(username, password): driver = browser() driver.get(Login_url) driver.maximize_window() XieFun = Login(driver) XieFun.username(username) XieFun.password(password) XieFun.button()
def test_login1(self): self.user_login_verify( username="******", password="******", verification="1234" ) po = Login(self.driver).getErrorMsg() self.assertEqual(po,"验证码不对",msg="测试用例预期结果不对!")
def test_login2(self): self.user_login_verify( username="******", password="******", verification="1234" ) po = Login(self.driver).getErrorMsg() self.assertEqual(po,"验证码不正确",msg="测试用例预期结果不对!") # if __name__ == '__main__': # unittest.main()
class login(unittest.TestCase): def setUp(self): self.driver = browser() self.driver.get(Login_url) self.driver.maximize_window() self.XieFun = Login(self.driver) @ddt.data(*test_data) def test1(self, data): self.XieFun.username(data['username']) self.XieFun.password(data['password']) self.XieFun.button() def tearDown(self): sleep(2) self.driver.quit()
def setUp(self): self.driver = browser() self.driver.get(Login_url) self.driver.maximize_window() self.XieFun = Login(self.driver)
def user_login_verify(self,username='',password='',verification=''): Login(self.driver).login_action(username,password,verification)
class Demo(unittest.TestCase): def setUp(self): self.url = "https://mail.163.com" self.title = "网易" self.user_name = "13075910470" #账号 self.user_password = "******" #密码 self.driver = webdriver.Chrome() self.imgs = [] # @BeautifulReport.add_test_img("测试报告") def test_1_login(self): self.login_page = Login(self.driver, self.url, self.title) self.login_page.open() self.login_page.click_on(("id", "lbNormal")) self.login_page.chage_frame() sleep(3) self.login_page.input_name(self.user_name) self.login_page.input_password(self.user_password) sleep(2) #login_page.save_img("测试报告") #截图 self.login_page.click_on(("id", "dologin")) sleep(2) self.login_page.add_img(self.imgs) print(self.login_page.get_login_message()) assert "网易邮箱6.0版" in self.login_page.get_login_message() def tearDown(self): print("结束") self.driver.close()
def qianzhihouzhi(self): Login().login_page() print("打开图片文件夹") yield print("关闭浏览器")
def login(self): Login().login_page()
def getin_my(self): self.touch_button(self.__my_button_locator) return Login(self.driver)
def test_login_failure(self, login_qianzhihouzhi01, username, password): Login().login_page(username, password) assert 2 == 2
def test_login_succeed(self, login_qianzhihouzhi01, username, password): Login().login_page(username, password) assert 1 == 1
def to_login(self): return Login()
def setUpClass(cls) -> None: cls.driver = webdriver.Chrome() cls.dx_login = Login(cls.driver) cls.dx_add = Search(cls.driver) # cls.dx_login.login() cls.bd = BaiDu(cls.driver)
def test_mdes_record_policy(self, create_driver, data, record_result): data_dict = {} login = Login(create_driver) login.login() time.sleep(2) menu = MenuPage(create_driver) # 投保事项--险种信息 policy = PolicyInputPage(create_driver) policy.cont_no_input(data) policy.policy_input(data) data_dict.update( policy.data_dict) #将policy_input_page.py文件中的字典更新到这个字典中 print('#' * 40) print(data_dict) record_result.append(data_dict) #再将这个字典中的内容追加到列表中 print(record_result) #客户信息页 menu.click_client_info() # 客户信息--投被保险人关系 client_selectrelation_pagearea = ClientSelectRelationPagearea( create_driver) time.sleep(1) client_selectrelation_pagearea.select_relation(data) # 客户信息--投保人信息 client_inputappnt_pagearea = ClientInputAppntPagearea(create_driver) client_inputappnt_pagearea.input_appnt_info(data) # 客户信息--被保人信息 client_inputinsured_pagearea = ClientInputInsuredPagearea( create_driver) if data.get('appnt_relation') != '本人': client_inputinsured_pagearea.input_insured_info(data) # 客户信息--身故受益人信息 client_inputbenefit_pagearea = ClientInputBenefitPagearea( create_driver) client_inputbenefit_pagearea.input_benefit_info(data) data_dict.update(client_inputappnt_pagearea.data_dict) record_result = [] record_result.append(data_dict) #告知及授权 menu.click_authorization() # 点击告知及授权 authorization = AuthorizationPage(create_driver) time.sleep(2) authorization.authorization_input(data) authorization.agent_input(data) # 三个标签页再点击一次做为保存 menu.click_policy_tab() time.sleep(1) policy.get_year() # 投保事项 填入年金领取年龄 menu.click_authorization() # 点击告知及授权 menu.click_policy_tab() # 点击投保事项标签 # 点击“提交审核” menu.submit_policy() #查询并将信息写入excel search_policy = SearchPage(create_driver) data_dict.update(search_policy.search_policy_number()) record_result = [] record_result.append(data_dict) print(record_result)