def func_basic(self, data1, data2, data3): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '电子邮件') MenuUtils(self.driver).menu_tab('li', '发送管理') MenuUtils(self.driver).menu_tab('li', '发送个性邮件') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_310') # 获取iframe # self.send_receive(data1) self.input_text(speml.pemail_receive, "发送个性邮件_选择模板", data1) self.click_element(speml.pemail_upload, "发送个性邮件_导入") self.click_element(speml.pemail_select, "发送个性邮件_选择模板") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_goTemplateList') # 获取iframe # self.send_checkbox() self.click_element(speml.pemail_checkbox, "发送个性邮件_勾选复选框") self.click_element(speml.pemail_checkboxAffirm, "发送个性邮件_勾选复选框确认选择模板") self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_310') # 获取iframe time.sleep(2) # self.send_senderName(data2, data3) self.input_text(speml.pemail_senderName, "发送个性邮件_输入收件人名称", data2) self.input_text(speml.pemail_domain, "发送个性邮件_输入邮件主题", '*****@*****.**') self.input_text(speml.pemail_theme, "发送个性邮件_输入邮件主题", data3) self.click_element(speml.pemail_variable, "发送个性邮件_提交发送") MenuUtils(self.driver).menu_tab('li', '姓名') self.click_element(speml.pemail_submit, "发送个性邮件_提交发送") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe
def func_basic(self, data1, data2, data3): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '彩信') MenuUtils(self.driver).menu_tab('li', '制作彩信') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_42') # 获取iframe self.send_makeMms(data1, data2, data3)
def func_comm(self): MenuUtils(self.driver).menu_tab('li', '视频短信') # 点击彩信产品 MenuUtils(self.driver).menu_tab('li', '我的视频短信') MenuUtils(self.driver).menu_tab('li', '模板报备中心') self.driver.implicitly_wait(4) comm_frame(self.driver).Frame('mainFrame_1884') # 获取iframe self.driver.implicitly_wait(2)
def func_comm(self): MenuUtils(self.driver).menu_tab('li', '彩信') # 点击彩信产品 MenuUtils(self.driver).menu_tab('li', '我的彩信') MenuUtils(self.driver).menu_tab('li', '平台彩信审核箱') self.driver.implicitly_wait(4) comm_frame(self.driver).Frame('mainFrame_45') # 获取iframe self.driver.implicitly_wait(2)
def func_comm(self): MenuUtils(self.driver).menu_tab('li', '视频短信') # 点击彩信产品 MenuUtils(self.driver).menu_tab('li', '我的视频短信') time.sleep(2) MenuUtils(self.driver).menu_tab('li', '已发视频短信') self.driver.implicitly_wait(4) comm_frame(self.driver).Frame('mainFrame_1888') # 获取iframe self.driver.implicitly_wait(2)
def func_comm(self): MenuUtils(self.driver).menu_tab('li', '电子邮件') # 点击彩信产品 MenuUtils(self.driver).menu_tab('li', '发送管理') time.sleep(2) MenuUtils(self.driver).menu_tab('li', '已发邮件') self.driver.implicitly_wait(4) comm_frame(self.driver).Frame('mainFrame_154') # 获取iframe self.driver.implicitly_wait(2)
def func_basic(self, data1, data2, data3, value, time_timeing, data4, valueOne, valueTwo): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '电子邮件') MenuUtils(self.driver).menu_tab('li', '发送管理') MenuUtils(self.driver).menu_tab('li', '发送普通邮件') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_105') # 获取iframe self.input_text(sgeml.gemail_receive, "发送普通邮件_输入收件人", data1) self.click_element(sgeml.gemail_extract, "发送普通邮件_提取邮件") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe self.click_element(sgeml.gemail_extractClose, "发送普通邮件_提取邮件关闭弹窗") comm_frame(self.driver).Frame('mainFrame_105') # 获取iframe self.click_element(sgeml.gemail_select, "发送普通邮件_选择模板") self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_goTemplateList') # 获取iframe time.sleep(2) self.click_element(sgeml.gemail_checkbox, "发送普通邮件_勾选复选框") self.click_element(sgeml.gemail_checkboxAffirm, "发送普通邮件_勾选复选框确认选择模板") self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_105') # 获取iframe self.input_text(sgeml.gemail_senderName, "发送普通邮件_输入收件人名称", data2) # 取消readonly属性变为可输入 comm_readonly(self.driver).readonly('sendMailAddress') # 输入发件人域名 time.sleep(2) self.input_text(sgeml.gemail_domain, "发送普通短信_定时时间", '*****@*****.**') self.input_text(sgeml.gemail_theme, "发送普通邮件_输入邮件主题", data3) if value == '立即发送': self.click_element(sgeml.gemail_now, "发送普通邮件_立即发送") elif value == '定时发送': self.click_element(sgeml.gemail_timeing, "发送普通邮件_定时发送") comm_readonly(self.driver).readonly('timingTime') # 输入发件人域名 time.sleep(2) self.input_text(sgeml.time_timeing, "发送普通短信_定时时间", time_timeing) if valueOne == '测试发送': self.click_element(sgeml.gemail_submit, "发送普通邮件_测试发送") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe self.input_text(sgeml.gemail_mailAddress, "发送普通邮件_输入收件人名称", data4) if valueTwo == '确认发送': self.click_element(sgeml.gemail_send, "发送普通邮件_确认发送") time.sleep(2) self.click_element(sgeml.msg_confirm, "发送普通邮件_确定") elif valueTwo == '取消发送': self.click_element(sgeml.gemail_cancel, "发送普通邮件_取消发送") elif valueOne == '提交发送': self.click_element(sgeml.gemail_commit, "发送普通邮件_提交发送") self.driver.switch_to.default_content() # 释放iframe if valueTwo == '确认发送': time.sleep(2) self.click_element(sgeml.gemail_extractClose, "发送普通邮件_确认发送_关闭") time.sleep(2)
def test_sendVideoMsg_2_success(self): temp = True logging.info("*********发送视频短信用例:发送普通视频短信*********") svmp(self.driver).func_basic(suceess_datas['phone'], '立即发送', suceess_datas['time'], '确认发送') self.driver.implicitly_wait(5) # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '视频短信') MenuUtils(self.driver).menu_tab('li', '视频短信审核箱') time.sleep(2) temp = svmp(self.driver).func_results('approvalStatusStr', '入库成功', '已发视频短信', 'mainFrame_1888', 'statusCode', 'remark', '提交失败') # 断言判断与预期是否一致 self.assertTrue(temp)
def func_linkBasics(self, data1, data2, data3, data4): temp = True comm_frame(self.driver).Frame('mainFrame_26') # 获取iframe self.send_normal_msg(data1, data2) self.send_immediately() # 立即发送 self.send_link() # 选择开启链接跟踪 MenuUtils(self.driver).menu_tab('li', '开启') self.driver.switch_to.default_content() # 释放iframe time.sleep(2) if data3 == self.get_popMsg(): self.send_closeLink() # 关闭链接跟踪弹窗 comm_frame(self.driver).Frame('mainFrame_26') # 获取iframe self.send_submit() # 提交发送 time.sleep(2) self.driver.switch_to.default_content() # 释放iframe if data4 == self.get_popMsg(): self.send_suceedPop() # 点击弹窗上的确认发送按钮 else: print(self.get_popMsg()) temp = False else: print(self.get_popMsg()) temp = False return temp
def func_basic(self, data1, data2, data3, data4): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '彩信') MenuUtils(self.driver).menu_tab('li', '发送个性彩信') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_1004') # 获取iframe # SendPerMmsPage(self.driver).send_pMmsUpload(data1) self.input_text(sendpMms.phone_upload, "发送个性彩信_导入收件号码", data1) self.click_element(sendpMms.file_upload, "发送个性彩信_导入") time.sleep(2) # SendPerMmsPage(self.driver).send_content(data2, data3, data4) self.input_text(sendpMms.mms_title, "发送个性彩信_彩信标题", data2) self.input_text(sendpMms.mms_content, "发送个性彩信_彩信文字", data3) self.input_text(sendpMms.images_upload, "发送彩信_制作彩信本地上传", data4) self.click_element(sendpMms.inset_variable, "发送个性彩信_插入变量") MenuUtils(self.driver).menu_tab('li', '姓名') time.sleep(2)
def func_doubleBasics(self, data1, data2, data3): comm_frame(self.driver).Frame('mainFrame_26') # 获取iframe self.send_normal_msg(data1, data2) self.send_immediately() # 立即发送 self.send_unsubscribe() # 点击退订设置 MenuUtils(self.driver).menu_tab('li', data3) self.send_submit() # 提交发送 self.driver.switch_to.default_content() # 释放iframe
def func_results(self, nature1, textOne, redirect, iframe1, nature2, textTwo): temp = True # 获取列表返回值task_id getDataId = getList(self.driver).get_list('mainFrame_45', 0, '//*[@id="table_content"]', 'tr', 'dataid') # 获取短信审核箱中提交过来的审核状态 time.sleep(12) self.click_element(sendpMms.msg_refresh, "短信审核箱_刷新") msg_checkTr = self.driver.find_element_by_css_selector('[dataid="' + str(getDataId) + '"]') msg_dispose = getProperty(self.driver).get_pro(msg_checkTr, 'handleStatusStr') 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 `mms_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) + '"]') # 获取属性为'sendStatus'的元素 msg_text = getProperty(self.driver).get_pro( msg_alreadyTr, nature2) msg_check = getProperty(self.driver).get_pro( msg_alreadyTr, 'statusCodeEn') # 判断发送状态与预期是否相符 if msg_check.text == '余额不足': print(msg_check.text) break elif textTwo != msg_text.text: print(msg_alreadyTr.text) print('状态代码' + msg_text.text) temp = False break else: print('找不到元素') temp = False else: print(msg_checkTrOne.text) temp = False else: print(msg_dispose.text) temp = False return temp
def func_results(self, nature1, textOne, redirect, iframe1, nature2, nature3, nature4, textTwo, ): temp = True # 获取列表返回值task_id getDataId = getList(self.driver).get_list('mainFrame_28', 0, '//*[@id="table_content"]', 'tr', 'dataid') # 获取短信审核箱中提交过来的审核状态 time.sleep(12) self.click_element(sbml.msg_refresh, "短信审核箱_刷新") msg_checkTr = self.driver.find_element_by_css_selector('[dataid="' + str(getDataId) + '"]') msg_checkTrOne = getProperty(self.driver).get_pro(msg_checkTr, nature1) msg_dispose = getProperty(self.driver).get_pro(msg_checkTr, 'handleStatusStr') msg_content = getProperty(self.driver).get_pro(msg_checkTr, 'sendContentStr') print(msg_content) print(msgDatas.birthday_success['content']) if msg_content.text == msgDatas.birthday_success['content']: if msg_dispose.text == '处理成功': # 判断审核状态是否与预期一致 if msg_checkTrOne.text == textOne: self.driver.switch_to.default_content() # 释放iframe self.driver.implicitly_wait(5) MenuUtils(self.driver).menu_tab('li', redirect) self.driver.implicitly_wait(5) comm_frame(self.driver).Frame(iframe1) # 连接数据库循环判断已发短信是否有对应id Arr = connectMysql(self.driver).connect_mysql('192.168.0.152', 'nemmp_sms_zk', "SELECT * FROM `sms_task_birthday_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) + '"]') # 获取属性为'sendStatus'的元素 msg_text = getProperty(self.driver).get_pro(msg_alreadyTr, nature2) # 获取属性为'statusCodeCh'的元素 msg_remark = getProperty(self.driver).get_pro(msg_alreadyTr, nature3) # 获取状态码信息 msg_status = getProperty(self.driver).get_pro(msg_alreadyTr, nature4) # 判断发送状态与预期是否相符 if textTwo != msg_text.text: print(msg_alreadyTr.text) print(msg_text.text) print('代码注释:' + msg_remark.text) print('状态代码'+msg_status) 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_basic(self, data, value, time_timeing, valueOne): # 选择菜单到发送普通彩信 MenuUtils(self.driver).menu_tab('li', '彩信') MenuUtils(self.driver).menu_tab('li', '发送普通彩信') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_43') # 获取iframe # 输入收件号码 self.input_text(SendMmsLocator.mms_phone, "发送普通彩信_收件号码", data) self.click_element(SendMmsLocator.mms_extractPhone, "发送普通彩信_提取号码") self.driver.switch_to.default_content() # 释放iframe time.sleep(2) # 关闭提取号码弹窗 self.click_element(SendMmsLocator.mms_close, "发送普通彩信_关闭弹窗") comm_frame(self.driver).Frame('mainFrame_43') # 获取iframe # 选择彩信产品 self.click_element(SendMmsLocator.mms_select, "发送普通彩信_选择彩信产品") self.driver.switch_to.default_content() # 释放iframe time.sleep(2) comm_frame(self.driver).Frame('mainFrame_goChoseMmsProduct') # 获取iframe self.click_element(SendMmsLocator.mms_product, "发送普通彩信_勾选彩信产品") self.click_element(SendMmsLocator.mms_affirm, "发送普通彩信_确认选择") self.driver.switch_to.default_content() # 释放iframe time.sleep(2) comm_frame(self.driver).Frame('mainFrame_43') # 获取iframe if value == '立即发送': self.click_element(SendMmsLocator.mms_promptly, "发送普通彩信_立即发送") # 定时发送 else: self.click_element(SendMmsLocator.mms_timeing, "发送普通彩信_定时发送") # 取消readonly属性变为可输入 js = 'document.getElementById("timingTime").removeAttribute("readonly")' self.driver.execute_script(js) # 输入定时时间 self.input_text(SendMmsLocator.time_alarm, "发送普通短信_定时时间", time_timeing) self.click_element(SendMmsLocator.mms_submit, "发送普通彩信_提交发送") self.driver.switch_to.default_content() # 释放iframe if valueOne == '确认发送': self.click_element(SendMmsLocator.mms_send, "发送普通彩信_确认") else: self.click_element(SendMmsLocator.mms_cancel, "发送普通彩信_取消发送") return time_timeing
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_basic(self, name, count, content, filePath, value): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '视频短信') MenuUtils(self.driver).menu_tab('li', '制作视频短信') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_1885') # 获取iframe self.input_text(smvl.videoMsg_name, "制作视频短信输入标题", name) if count == 0: MenuUtils(self.driver).menu_tab('li', '插入文本') self.input_text(smvl.videoMsg_content_1, "制作视频短信输入文本内容", content) MenuUtils(self.driver).menu_tab('li', '插入视频') self.click_element(smvl.videoMsg_video_1, "制作视频短信-上传视频文件") UpLoad_File(filePath) elif count == 1: MenuUtils(self.driver).menu_tab('li', '插入视频') self.click_element(smvl.videoMsg_video_2, "制作视频短信-上传视频文件") UpLoad_File(filePath) MenuUtils(self.driver).menu_tab('li', '插入文本') self.input_text(smvl.videoMsg_content_2, "制作视频短信输入文本内容", content) elif count == 2: MenuUtils(self.driver).menu_tab('li', '插入图片') self.click_element(smvl.videoMsg_images_1, "制作视频短信-上传图片文件") UpLoad_File(filePath) MenuUtils(self.driver).menu_tab('li', '插入文本') self.input_text(smvl.videoMsg_content_2, "制作视频短信输入文本内容", content) elif count == 3: MenuUtils(self.driver).menu_tab('li', '插入文本') self.click_element(smvl.videoMsg_content_1, "制作视频短信-输入文本内容") MenuUtils(self.driver).menu_tab('li', '插入图片') self.input_text(smvl.videoMsg_images_2, "制作视频短信上传图片", content) UpLoad_File(filePath) time.sleep(2) self.click_element(smvl.videoMsg_saveReviews, "制作视频短信-点击提交审核") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe if value == "确认": self.click_element(smvl.videoMsg_affirm, "制作视频短信-点击确认") else: self.click_element(smvl.videoMsg_close, "制作视频短信-点击关闭")
def func_basic(self, data, value, time_timeing, valueOne): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '视频短信') MenuUtils(self.driver).menu_tab('li', '发送普通视频短信') time.sleep(2) comm_frame(self.driver).Frame('mainFrame_1886') # 获取iframe self.input_text(videoMsgLoc.videoMsg_phone, "发送普通视频短信_输入收件号码", data) self.click_element(videoMsgLoc.videoMsg_extract, "发送普通视频短信_提取号码") self.driver.switch_to.default_content() # 释放iframe time.sleep(2) self.click_element(videoMsgLoc.videoMsg_close, "发送普通视频短信_点击关闭弹窗") comm_frame(self.driver).Frame('mainFrame_1886') # 获取iframe self.click_element(videoMsgLoc.videoMsg_product, "发送普通视频短信_点击选择视频短信产品") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_goChoseVideoSmsProduct') # 获取iframe self.click_element(videoMsgLoc.videoMsg_check, "发送普通视频短信_勾选复选框") self.click_element(videoMsgLoc.videoMsg_affirm, "发送普通视频短信_确认选择") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_1886') # 获取iframe if value == '立即发送': self.click_element(videoMsgLoc.videoMsg_now, "发送普通视频短信_立即发送") elif value == '定时发送': self.click_element(videoMsgLoc.videoMsg_timeing, "发送普通视频短信_定时发送") # 取消readonly属性变为可输入 js = 'document.getElementById("timingTime").removeAttribute("readonly")' self.driver.execute_script(js) # 输入定时时间 self.input_text(videoMsgLoc.time_alarm, "发送普通短信_定时时间", time_timeing) self.click_element(videoMsgLoc.videoMsg_submit, "发送普通视频短信_提交发送") time.sleep(2) self.driver.switch_to.default_content() # 释放iframe if valueOne == '确认发送': self.click_element(videoMsgLoc.videoMsg_confirm, "发送普通视频短信_点击确定") else: self.click_element(videoMsgLoc.videoMsg_cancel, "发送普通视频短信_点击取消") return time_timeing
def func_basic(self, value, title, content): # 选择菜单到彩信 MenuUtils(self.driver).menu_tab('li', '电子邮件') MenuUtils(self.driver).menu_tab('li', '邮件模板') MenuUtils(self.driver).menu_tab('li', '制作模板') comm_frame(self.driver).Frame('mainFrame_101') # 获取iframe self.input_text(smel.memail_tile, '输入模板名称', title) self.driver.implicitly_wait(2) if value == '普通邮件': self.click_element(smel.memail_general, '选择制作普通邮件') else: self.click_element(smel.memail_personality, '选择制作个性邮件') self.click_element(smel.memail_variable, '点击插入的变量') MenuUtils(self.driver).menu_tab('li', '全部联系人') self.driver.implicitly_wait(2) self.driver.switch_to_frame(self.driver.find_element_by_xpath('//*[@id="cke_1_contents"]/iframe')) self.input_text(smel.memail_content, '输入邮件内容', content) self.driver.switch_to.default_content() # 释放iframe self.driver.implicitly_wait(2) comm_frame(self.driver).Frame('mainFrame_101') # 获取iframe self.click_element(smel.memail_save, '点击保存') self.driver.implicitly_wait(2) return title
def func_results(self, nature1, textOne, redirect, iframe1, nature2, nature3, textTwo): temp = True # 获取列表返回值task_id getDataId = getList(self.driver).get_list('mainFrame_106', 0, '//*[@id="table_content"]', 'tr', 'dataid') # 获取短信审核箱中提交过来的审核状态 time.sleep(60) # wait = WebDriverWait(driver, 20) self.click_element(sgeml.msg_refresh, "短信审核箱_刷新") msg_checkTr = self.driver.find_element_by_css_selector('[dataid="' + str(getDataId) + '"]') msg_dispose = getProperty(self.driver).get_pro(msg_checkTr, 'handleStatusStr') 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) time.sleep(20) self.click_element(sgeml.video_refresh, "短信审核箱_刷新") # 连接数据库循环判断已发短信是否有对应id Arr = connectMysql(self.driver).connect_mysql('192.168.0.155', 'nemmp_common', "SELECT * FROM `mail_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) + '"]') # 获取属性为'returnMsg'的元素 msg_text = getProperty(self.driver).get_pro(msg_alreadyTr, nature2) msg_return = getProperty(self.driver).get_pro(msg_alreadyTr, nature3) # 判断发送状态与预期是否相符 if textTwo != msg_text.text: print(msg_alreadyTr.text) print('状态:' +msg_text.text) print('投递详情:' + msg_return.text) temp = False break else: print('找不到元素') temp = False else: print(msg_checkTrOne.text + '不等于入库成功(等待时间60s)') temp = False else: print(msg_dispose.text + '不等于处理完成') temp = False return temp
def func_basic(self, data1, data2, data3, data4, data5): # 选择菜单到生日短信 MenuUtils(self.driver).menu_tab('li', '直客短信') MenuUtils(self.driver).menu_tab('li', '发送生日短信') self.driver.implicitly_wait(5) comm_frame(self.driver).Frame('mainFrame_353') # 获取iframe self.send_upload() UpLoad_File(data1) self.driver.implicitly_wait(5) self.click_element(sbml.birthday_tuid, "退订设置") MenuUtils(self.driver).menu_tab('li', '关闭') self.driver.implicitly_wait(5) self.send_birthday_msg(data2) MenuUtils(self.driver).menu_tab('li', data3) self.send_hour() MenuUtils(self.driver).menu_tab('li', data4) self.send_minute() MenuUtils(self.driver).menu_tab('li', data5) self.send_dispose() self.driver.switch_to.default_content() # 释放iframe
def func_comm(self): MenuUtils(self.driver).menu_tab('li', '直客短信') # 点击短信审核箱 MenuUtils(self.driver).menu_tab('li', '已发短信') comm_frame(self.driver).Frame('mainFrame_30') # 获取iframe self.driver.implicitly_wait(2)