-2

I'm running a program for adding screenshot in extent report automatically using selenium. Program is running perfectly,but I want to know the meaning of System.getProperty line in below program .

public class SST 
{
    public static String getScreenshot(WebDriver driver)
    {
    TakesScreenshot ts=(TakesScreenshot) driver;
        File src=ts.getScreenshotAs(OutputType.FILE);
    String path = System.getProperty("user.dir")+"/Screenshot/"+System.currentTimeMillis()+".png";
        File destination=new File(path);

        try 
        {
            FileUtils.copyFile(src, destination);
        } catch (IOException e) 
        {
            System.out.println("Capture Failed "+e.getMessage());
        }
        return path;
    }
}
Mate Mrše
  • 7,997
  • 10
  • 40
  • 77
  • Put a breakpoint on that line and step through it and see what it returns. Write it to console, etc. There are a lot of ways to figure this out... which have you tried? Did you look up the documentation? Is there something you are confused about? Please clarify your question. – JeffC May 20 '19 at 13:24
  • I just wanted to know the background process of that line. – user10796675 May 20 '19 at 13:38
  • Great, then you can start with all the suggestions I made in my first comment and if you still don't understand, then you can ask a question with a clear statement of what you have tried/read and what you specifically don't understand. Right now it seems like you haven't done ANY research into your problem and just dumped some code and asked us to explain it to you... that may not be the actual case but that's what it seems like. – JeffC May 20 '19 at 13:48

1 Answers1

0

It is getting the user home directory, for example, C:\Users\user10796675.

Mate Mrše
  • 7,997
  • 10
  • 40
  • 77