Skip to main content

Posts

Showing posts from March, 2018

How to take a full webpage screenshot using AShot library

AShot library Ashot library by yandex.ru is something which I recently found. It can be used for multiple browsers. It is very simple to use. Just add maven dependency in your java code. < dependency > < groupId > ru.yandex.qatools.ashot </ groupId > < artifactId > ashot </ artifactId > < version > 1.5.2 </ version > </ dependency > </ pre > Then call the takeScreenshot() function,as shown below and you have a screenshot file. new AShot () .shootingStrategy( ShootingStrategies . viewportPasting( 100 )) .takeScreenshot(myWebDriver); You could even select specific html elements and take their screenshots. WebElement webElement = webDriver . findElement( By . cssSelector( "#element_to_be _captured" )); new AShot () .takeScreenshot(myWebDriver, webElement); All this can be found at below repository. https://github.com/yandex-qatools/ashot Know of any more libraries