范围报告:无法在其他机器上看到屏幕截图 [英] Extent Report: Not able to see the screenshots on other machine

查看:26
本文介绍了范围报告:无法在其他机器上看到屏幕截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够在我的本地机器上生成带有屏幕截图的范围报告.但是当我将报告邮寄给其他人,或在不同的机器上打开 html 时,屏幕截图不可见.它说路径无效.

I am able generate the extent reports with screenshots on my local machine. But when i mail the reports to someone else, or open the html on a differant machine, the screenshots are not visible. It says that the path is invalid.

附上截图时,我提供了本地机器的路径.它也在其他机器上搜索相同的路径.我也尝试将 html 和图片压缩到一个文件夹中.

While attaching the screenshot, i am giving the path of my local machine. And it is searching the same path on other machine too. I tried zipping the html and pics in one folder too.

请帮助我如何将屏幕截图附加到不依赖本地机器的 html 文件中.

Please help me how to attach the screenshots into html file without local machine dependency.

推荐答案

我遇到了同样的问题.

与所有人共享您存储屏幕截图的文件夹,并在下面的方法中返回相同的路径.

Share the folder in which you are storing the screenshots with everyone and return same path in below method.

public static String getScreenshot(WebDriver oDriver, String ScreenShotName) throws IOException
    {
        String dateName=new SimpleDateFormat("YYYYMMDDHHMMSS").format(new Date());
        TakesScreenshot ts=(TakesScreenshot)oDriver;
        File source=ts.getScreenshotAs(OutputType.FILE);
        String destination=System.getProperty("user.dir")+"/FailedScreenshots/"+ScreenShotName+dateName+".png";
        File finalDestination=new File(destination);
        FileUtils.copyFile(source, finalDestination);

        String Imagepath="file://Machinename/FailedScreenshots/"+ScreenShotName+dateName+".png";
        return Imagepath;
    }

希望这会有所帮助!

这篇关于范围报告:无法在其他机器上看到屏幕截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆