Is it possible to copy and paste my extent report to local drive?

Viewed 32

I want to copy extent report and paste into my local drive using Selenium/Java/Maven I tried with FileInputSteam , nothing worked Can someone help me on this, Thanks.

1 Answers

Import the following dependency in your project

<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
    <groupId>commons-io</groupId>
    <artifactId>commons-io</artifactId>
    <version>2.11.0</version>
</dependency>

Now you can copy the file from one directory to another.

 String currentDirectory=System.getProperty("user.dir");
    File source = new File(currentDirectory+"\\yourextendreport.html");
    File dest = new File("D:\\test\\test2\\yourextendreport.html");
    try {
        FileUtils.copyDirectory(source, dest);
    } catch (IOException e) {
        e.printStackTrace();
    }

If you want to copy the folder then use copyDirectory

FileUtils.copyDirectory(source, dest);

Hope this will solve your issues

Related