Hello , please tell me how can i take the screenshot of webpage by using selenium Webdriver in java ??

  • Have you tried to Google? I've heard some people have found useful information there. stackoverflow.com/questions/3422262/…
    – dzieciou
    Jun 16, 2016 at 10:41
  • @TESTasy sightly different question to that one and it doesnt contain an accepted answer. I agree with dzieciou that this is the same as the one on stack so lifted it as an answer here to make it easier for people to find. (as this is Actually where it should be ;) )
    – ECiurleo
    Jun 16, 2016 at 11:24
  • Questions should not be cross posted
    – dzieciou
    Jun 16, 2016 at 11:52

1 Answer 1


Yes, it is possible. The following example is in Java:

WebDriver driver = new FirefoxDriver();
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// Now you can do whatever you need to do with it, for example copy somewhere
FileUtils.copyFile(scrFile, new File("c:\\tmp\\screenshot.png"));

This answer has been lifted from stackoverflow and written by Sergii Pozharov as the question could be useful to others within SQA.

Not the answer you're looking for? Browse other questions tagged or ask your own question.