Automation 使用rebot工具时如何处理屏幕截图

Automation 使用rebot工具时如何处理屏幕截图,automation,robotframework,Automation,Robotframework,我想使用rebot工具合并一些测试套件的结果。但我不知道如何处理综合报告中的屏幕截图。每个测试套件中的超时屏幕截图的名称相同(如selenium屏幕截图-(1).png…) 你能帮我吗你可以找到模块“\u屏幕快照关键字”并替换代码 def _get_screenshot_paths(self, filename): if not filename: # self._screenshot_index += 1 from robo

我想使用rebot工具合并一些测试套件的结果。但我不知道如何处理综合报告中的屏幕截图。每个测试套件中的超时屏幕截图的名称相同(如selenium屏幕截图-(1).png…)
你能帮我吗

你可以找到模块“\u屏幕快照关键字”并替换代码

    def _get_screenshot_paths(self, filename):
        if not filename:
#            self._screenshot_index += 1
            from robot.libraries.BuiltIn import BuiltIn
            variables = BuiltIn().get_variables()
            test=variables['${TEST NAME}']
            testsuite=variables['${SUITE NAME}']
            file= testsuite+"."+test
            filename = 'selenium-screenshot-%s.png' % file
        else:
            filename = filename.replace('/', os.sep)
        logdir = self._get_log_dir()
        path = os.path.join(logdir, filename)
        link = robot.utils.get_link_path(path, logdir)
        return path, link

您可以找到模块“\u ScreenshotKeywords”并替换代码

    def _get_screenshot_paths(self, filename):
        if not filename:
#            self._screenshot_index += 1
            from robot.libraries.BuiltIn import BuiltIn
            variables = BuiltIn().get_variables()
            test=variables['${TEST NAME}']
            testsuite=variables['${SUITE NAME}']
            file= testsuite+"."+test
            filename = 'selenium-screenshot-%s.png' % file
        else:
            filename = filename.replace('/', os.sep)
        logdir = self._get_log_dir()
        path = os.path.join(logdir, filename)
        link = robot.utils.get_link_path(path, logdir)
        return path, link