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 testingpool.com. He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

Leave a Reply

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