Join us on :

Screenshot with WebdriverIO

Test cases may fail while executing the test cases. While we are executing the test cases manually we just take a screenshot and place in local machine as image or as document of images then attch to the required bug or test in Test management tool.

The same can be done by using WebDriverIO, Some of the places we might need to capture screenshot with WebDriverIO.

  • Application issues
  • Assertion Failure
  • Visiblity issues like Difficulty to find Webelements on the web page
  • Loading issues like Timeout to find Webelements on the web page

Syntax to capture and save the screenshot using WebdriverIO

									browser.saveScreenshot("file name with path")

Donot forget to mention the screenshot name with .png extension

You must provide the file name for the screenshot along with the file path, by the way you cannot take element level screenshot in WebdriverIO.

it('Navigation Commands with WebdriverIO', () => {
	/*below line won't work, also won't throw error

By default webdriverIO take the given path as relative path with respect to the conf file.

About Author

Article is written by Pavan (a) KarthiQ. Well, I am serving notice period in an MNC, Bangalore. I thought to enrich every person knowledge a little, I always have a feeling, when we teach something, we will learn more than what you know. Knowledge is the only thing that doubles when you spend it.

I have also created the reporter for Protractor Jasmine. Use for your projects without any hesitation

Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions