I have made a demo project on GitHub:
- GitHub - kazurayam/TakingScreenshotOfSelectedWebElement: Taking screen shot of a selected WebElement using AShot in Katalon Studio
Problem to solve
This project proposes a solution to a discussion posted at Katalon Forum. The original question was:
I want to screen only the parts of a website, which I can see on my desktop. The Katalon screenshot command will screenshot a big part of the website. It would be great if I could decide which parts of a website the screenshot should take.
aShot, a WebDriver Screenshot utility, provides an immediate solution to this.
This project shows you how to use aShot in a Katalon Studio project, and provides a working example of taking a screenshot of a selected HTML element in a Web page.
- download the zip of this project at https://github.com/kazurayam/TakingScreenshotOfSelectedWebElement/releases
- unzip it. you get the project folder
- start Katalon Stuio, open the project
Test Cases/TC1and run it with your favorites browser
- the test script will open Katalon Forum and take screenshot of the banner
- when the test script finished, you will find a PNG file
Please read the source codes and see what I did.