How to capture the screen shot in selenium

In the previous post, we have learnt about Maven in detail. In this post, we will learn How to capture the screen shot in selenium ?

We will write a TestNG program where we have created 3 methods using annotations like @BeforeTest, @AfterTest and @Test. Which are handling the following functionalities.

  • @BeforeTest: It will intialize the driver and open the gmail application.
  • @Test: We are capturing the screen shot here.
  • @AfterTest: We will close the browser.

Let’s understand this with the below code.

This is box title
Have any question or suggestion for us?Please feel free to post in Q&A Forum
DesiredCapabilities in Selenium with Example
HTMLUnit Driver
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of This website is his window to the world. He believes that ,"Knowledge increases by sharing but not by saving".

You may also like...

Leave a Reply

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