def func_preview(self, case): """ case=0:直接点击 case=1:选择两条记录; case=2:选择一条审核状态为审核通过的记录; case=3:选择一条审核状态为入库通过的记录; case=4:选择一条审核状态为未审核的记录; :param case: :return: temp """ temp = True self.func_comm() time.sleep(2) count = self.get_element_text(tmmsl.timingMms_count, "定时彩信——列表条数") count = int(ced(self.driver).comm_extractDigital(count)) if count > 0: if case == 0: # 直接点击取消 self.func_case_0(tmmsl.timingMms_preview) elif case == 1: pass elif case == 2: pass elif case == 3: pass elif case == 4: pass else: print('当前列表无记录') temp = False return temp
def func_verifyPhone(self, data1, data2, data3, data4): valid = ced(self.driver).comm_extractDigital(self.get_validPhone()) temp = True if data1 == self.get_phoneNum(): pass else: temp = False print('提取号码总数不正确') print(data1, self.get_phoneNum()) if data2 == self.get_errorPhone(): pass else: temp = False print(data2, self.get_errorPhone()) print('提取错误号码数不正确') if data3 == self.get_repetitionPhone(): pass else: temp = False print(data3, self.get_repetitionPhone()) print('提取重复号码数不正确') if data4 == valid: pass else: temp = False print(data4, valid) print('提取有效号码数不正确') return temp
def func_results(self, nature1, textOne, redirect, iframe1, nature2, nature3, textTwo): temp = True # 获取列表返回值task_id getDataId = getList(self.driver).get_list('mainFrame_1878', 0, '//*[@id="table_content"]', 'tr', 'dataid') # 获取短信审核箱中提交过来的审核状态 time.sleep(24) self.click_element(videoMsgLoc.msg_refresh, "短信审核箱_刷新") msg_checkTr = self.driver.find_element_by_css_selector('[dataid="' + str(getDataId) + '"]') msg_dispose = getProperty(self.driver).get_pro(msg_checkTr, 'handleStatusStr') count = self.get_element_text(videoMsgLoc.videoMsg_count, "视频短信审核箱——列表条数") count = int(ced(self.driver).comm_extractDigital(count)) print(count) if count != 0: if msg_dispose.text == '处理成功': msg_checkTrOne = getProperty(self.driver).get_pro(msg_checkTr, nature1) # 判断审核状态是否与预期一致 if msg_checkTrOne.text == textOne: self.driver.switch_to.default_content() # 释放iframe time.sleep(2) MenuUtils(self.driver).menu_tab('li', redirect) time.sleep(2) comm_frame(self.driver).Frame(iframe1) # 连接数据库循环判断已发短信是否有对应id Arr = connectMysql(self.driver).connect_mysql('192.168.0.155', 'nemmp_common', "SELECT * FROM `video_sms_task_contact`", int(getDataId), 0) if len(Arr) > 0: for id in Arr: # 通过dataid属性定位元素 msg_alreadyTr = self.driver.find_element_by_css_selector('[dataid="' + str(id) + '"]') # 获取属性为'remark'的元素 msg_text = getProperty(self.driver).get_pro(msg_alreadyTr, nature2) # 获取属性为'statusCode'的元素 msg_remark = getProperty(self.driver).get_pro(msg_alreadyTr, nature3) # 判断发送状态与预期是否相符 if textTwo != msg_text.text: print(msg_alreadyTr.text) print(msg_text.text) print('状态代码:' + msg_remark) temp = False break else: print('找不到元素') temp = False else: print(msg_checkTrOne.text) temp = False else: print(msg_dispose.text) temp = False else: print('列表没有数据') temp = False return temp
def func_derive(self, case): """ case=0: 导出-全部导出 case=1:导出-具体导出; :param case: :return: temp """ temp = True self.func_comm() time.sleep(2) count = self.get_element_text(rvml.reportVideo_count, "模板报备中心——列表条数") count = int(ced(self.driver).comm_extractDigital(count)) if count > 0: if case == 0: self.click_element(rvml.reportVideo_derive, "模板报备中心——导出") self.driver.implicitly_wait(2) self.driver.switch_to.default_content() # 释放iframe alter = self.get_element_text(rvml.reportVideo_alter, "模板报备中心——导出提示语") if alter == '您已成功创建导出任务,请到首页-导入导出-导出任务列表下载': pass else: print('导出提示语不正确') temp = False self.driver.implicitly_wait(2) self.click_element(rvml.reportVideo_close, "模板报备中心——导出-关闭") elif case == 1: pass elif count == 0: self.click_element(rvml.reportVideo_derive, "模板报备中心——导出") self.driver.implicitly_wait(2) self.driver.switch_to.default_content() # 释放iframe message = self.get_element_text(rvml.reportVideo_message, "模板报备中心——页面顶部提示语") if message == '当前无可导出的记录!': pass else: print('页面顶部提示语不正确') temp = False return temp