def test_stage_grade_query(self, area, cclass, name, expect): stage_query_data = (area, cclass, name) self.tw.stage_grade_query(self.driver, stage_query_data) #判断录入按钮,有则查询成功,没则失败 if Service.is_element_present( self.driver, By.CSS_SELECTOR, '#pe-result > tbody:nth-child(2) > tr:nth-child(3) > td:nth-child(9) > button:nth-child(1)' ): actual = "test_stage_grade_query_success" else: actual = "test_stage_grade_query_fail" #断言 self.assertEqual(expect, actual)
def test_login(self, uname, upass, vfcode, expect): # 将参数重新组织成字典 login_data = { 'username': uname, 'password': upass, 'verification': vfcode } self.login.do_login('..\\config\\base.conf', login_data) from selenium.webdriver.common.by import By if Service.is_element_present(self.driver, By.LINK_TEXT, '注销'): actual = 'success' self.driver.find_element_by_link_text('注销').click() else: actual = 'fail' self.driver.refresh() self.assertEqual(actual, expect)