예제 #1
0
 def screen_step(self,stepName):
     u"""浏览器页面截图"""
     nowtime = time.strftime("%Y%m%d%H%M%S")
     self.driver.get_screenshot_as_file(ReadConfig.get_image_path() + "%s.png" % nowtime)
     png = ReadConfig.get_image_path() + "%s.png" % nowtime
     self.doc.add_paragraph(stepName)
     self.doc.add_picture(png, width=Inches(6.0), height=Inches(3.0))
예제 #2
0
 def screen(self):
     u"""浏览器页面截图"""
     nowtime = time.strftime("%Y_%m_%d_%H_%M_%S")
     self.driver.get_screenshot_as_file(ReadConfig.get_image_path() +
                                        "%s.png" % nowtime)
예제 #3
0
        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())