• USA : +1 973 910 5725
  • INDIA: +91 905 291 3388
  • info@tekslate.com
  • Login

How to capture screen shot in Selenium


2To automate GUI test cases it is not possible to write the scripts to check the look and feel of the page .so, we can capture the screenshot and screenshot can be analyzed manually for GUI.

2If any test case fails to analysis the failed result we need to capture the screenshot.

2we can capture the screenshot in three formats.




Interested in mastering Selenium Training? Enroll now for FREE demo on Selenium Training In Pune.

** write a program to capture the screenshots for homepage & holidays page in spicejet.com

  • How to capture screenshot with timestamp.

Public  void screenshots(string str) throws exception{

Date format=new simple date format(“%//,mm-dd mn-mm-ss”);

Date d=new date();

String time=date format.format(d);


File f=((takes screen shot)driver).get screenshot as(output.file);

Check out the top Selenium Interview Questions now!

File units.copy file(f,new file(“E:\\workspace-10 am \\”+str+time+”.pvg”));



Public void f() throws exception {




For an Indepth knowledge on Selenium, click on below

Review Date
Reviewed Item
How to capture screen shot in Selenium
Author Rating

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

0 Responses on How to capture screen shot in Selenium"

    Leave a Message

    Your email address will not be published. Required fields are marked *

    Site Disclaimer, Copyright © 2016 - All Rights Reserved.


    Please leave a message and we'll get back to you soon.

    I agree to be contacted via e-mail.