def save_docreport(self, title): nowtime = time.strftime("%Y%m%d%H%M%S") title = title + '_' + nowtime self.doc.save(ReadConfig.get_reportDoc_path() + '%s.docx' % title)
title = title + '_' + nowtime self.doc.save(ReadConfig.get_reportDoc_path() + '%s.docx' % title) def add_dochead(self, title): return self.doc.add_heading(title, level=1) def screenshot_SaveAsDoc(self, stepName): self.screen_step(stepName) self.save_docreport(stepName) """================处理Docx测试记录===============""" def uploadFile(self, locator, filename): '''上传组件-上传完整文件 :param locator: 上传按钮元素 :param filename: 要上传的完整路径文件 ''' self.find_element_click(locator) time.sleep(2) args = r"E:\ProgramData\PycharmProjects\webtest\Common\upload.exe --chrome %s" % filename logger.info('要上传的文件路径:{}'.format(filename)) print('执行上传的参数:{}'.format(args)) os.system(args) time.sleep(3) if __name__ == '__main__': print("用例开始执行时间:" + time.strftime("%Y%m%d%H%M%S")) print(ReadConfig.get_image_path()) print(ReadConfig.get_reportDoc_path())