Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to capture screenshot in Appium ?

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 983
    Comment on it

    There are many times when we run our testcases there might be the possibility that testcases may fail and when the testcase may fail then the screenshot of the screen should be captured. We should use the following code to capture the screenshot:

    System.out.println("Capturing snapshot of the screen");
    File srcFile=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
    FileUtils.copyFile(srcFile, new File("Location of output file"));
    

    NOTE: Do not give the location of output file as C drive. Due to security reasons windows many times does not allow to write anything in C drive. So, you would not be able to see the file in C drive. If we give only the file name without directory then the file is saved in the root directory of the project.

 1 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: