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_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 get_list(self, frame, n, table, label, nature): comm_frame(self.driver).Frame(frame) # 获取iframe menu_table = self.driver.find_element_by_xpath(table) list = menu_table.find_elements_by_tag_name(label) # before_add_numbers = len(list) # print(before_add_numbers) getDataId = list[int(n)].get_attribute(nature) # print(getDataId) return getDataId
def test_sendGeneral_3_success(self, data): temp = True logging.info("*********发送普通短信用例:正常场景-提取号码总数*********") comm_frame(self.driver).Frame('mainFrame_26') # 获取iframe SendMsgPage(self.driver).send_normal_msg( data['phone'], msgDatas.success_data["content"]) temp = SendMsgPage(self.driver).func_verifyPhone( data["check1"], data["check2"], data["check3"], data["check4"]) # 断言判断与预期是否一致 self.assertTrue(temp)
def func_basics(self, data1, data2, time_timeing, value): comm_frame(self.driver).Frame('mainFrame_26') # 获取iframe self.send_normal_msg(data1, data2) if value == '立即发送': self.send_immediately() else: self.send_timeingMode(time_timeing) self.send_submit() # 提交发送 self.driver.switch_to.default_content() # 释放iframe return time_timeing
def test_sendPersonMms_2_success(self): logging.info("*********发送个性彩信用例:正常场景*********") temp = True SendPerMmsPage(self.driver).func_basic(success_pMmsDatas['phone'], success_pMmsDatas['title'], success_pMmsDatas['content'], success_pMmsDatas['imgs']) SendPerMmsPage(self.driver).send_submit() time.sleep(2) self.driver.switch_to.default_content() # 释放iframe comm_frame(self.driver).Frame('mainFrame_toSendYlan') # 获取iframe time.sleep(2) SendPerMmsPage(self.driver).send_promptly() time.sleep(4) temp = SendPerMmsPage(self.driver).func_results('approvalStatusStr', '入库成功', '已发彩信', 'mainFrame_47', 'statusCodeEn', "提交成功") # 断言判断与预期是否一致 self.assertTrue(temp)
def test_sendGeneral_2_success(self, data): logging.info("*********发送普通短信用例:正常场景-短信计费验证*********") comm_frame(self.driver).Frame('mainFrame_26') # 获取iframe SendMsgPage(self.driver).send_normal_msg( msgDatas.success_data["phone"], data["content"])
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(8) self.send_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') if msg_dispose.text == '处理成功': # 判断审核状态是否与预期一致 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.152', 'nemmp_sms_zk', "SELECT * FROM `sms_task_contact_202012` ORDER BY create_date DESC", 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 return temp