def test_todo(self): for key, value in CmccPage.userList.items(): driver = BrowserDriver(self) self.driver = driver.openbrowsemobile(self) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username_mb(key) cmcc.input_cmcc_password_mb(value) time.sleep(2) cmcc.click_cmcc_btn_mb() time.sleep(1) try: cmcc.click(CmccPage.firstTodomb)#这里入手,点击当前页面所有代办 try: cmcc.click(CmccPage.formText) # 点击正文 cmcc.get_screent_img() except Exception as e: print(Exception, ":", e) print("没有正文") time.sleep(2) try: cmcc.click(CmccPage.handleButton) # 点击处理 cmcc.get_screent_img() except Exception as d: print(Exception, ":", d) time.sleep(2) except Exception as c: print(Exception, ":", c) print("没有待办") time.sleep(2) self.driver.close()
def test_donecheck(self):#啊啊 for key,value in CmccPage.userList.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key)#改为列表读取 cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() cmcc.click(['id','gViewCloseBtnGViewInfo']) for i in range(5): try: self.driver.switch_to.frame('iframecontent-utsmain') cmcc.click(["xpath",'//*[@id="showRecord_2"]']) cmcc.click(['xpath',("/html/body/div[1]/div/div/div/div[2]/table/tbody/tr/td[2]/div/div/table/tbody/tr[" + str(i+1) + "]/td[3]/a")]) time.sleep(3) self.driver.implicitly_wait(30) cmcc.change_to_window(1) self.driver.implicitly_wait(30) try: cmcc.click(['id',"toFlowXspLink"]) #self.driver.find_element_by_id("processFormSubmitNext").click() openresult = (i + 1) cmcc.change_to_window(-1) # windows = self.driver.window_handles # self.driver.switch_to.window(windows[-1]) self.driver.close() cmcc.change_to_window(-1) # windows = self.driver.window_handles # self.driver.switch_to.window(windows[-1]) self.driver.close() except Exception as d: print(Exception,":",d) cmcc.get_screent_img() #print("第" + str(i + 1) + "条已办打开正常") except Exception as e: print(Exception,":",e) print("没有第" + str(i + 1) + "条已办") cmcc.get_screent_img() break self.assertEqual(openresult, (i + 1), msg=("测试失败,第" + str(i + 1) + "条已办打开不正常")) cmcc.change_to_window(0) cmcc.close()
def test_todocheck(self): for key, value in CmccPage.userList.items(): driver = BrowserDriver(self) self.driver = driver.openbrowser(self) openresult = 0 cmcc = CmccPage(self.driver) cmcc.input_cmcc_username(key) cmcc.input_cmcc_password(value) cmcc.click_cmcc_btn() #cmcc.get_screent_img() cmcc.click(['id', 'gViewCloseBtnGViewInfo']) for i in range(4): try: self.driver.switch_to.frame('iframecontent-utsmain') self.driver.find_element_by_xpath( "//*[@id='todo']/tbody/tr[" + str(i + 1) + "]/td[3]/a").click() time.sleep(3) self.driver.implicitly_wait(30) cmcc.change_to_window(1) try: cmcc.click(['id', "processFormSubmitNext"]) #self.driver.find_element_by_id("processFormSubmitNext").click() openresult = (i + 1) #time.sleep(2) self.driver.close() except Exception as d: print(Exception, ":", d) #print("第" + str(i + 1) + "条待办打开正常") except Exception as e: print(Exception, ":", e) print("没有第" + str(i + 1) + "条待办") cmcc.get_screent_img() break self.assertEqual(openresult, (i + 1), msg=("测试失败,第" + str(i + 1) + "条待办打开不正常")) cmcc.change_to_window(0) cmcc.close()