How to take a screenshot of the selected region on the screen and how to take a screenshot of the entire screen?
UiPath has an inbuilt Take Screenshot activity in UiPath.UIAutomation.Activities package. This activity can be used to take a screenshot of a specified UI element or a region.
Steps mentioned below (for Classic Take Screenshot activity):
- Create a sample process and ensure to install UiPath.UIAutomation.Activities from the Manage packages.
- From the Activities pane, search for 'Take Screenshot' activity and drag the same into the designer pane.
- Set the required Target (Input) in the Properties pane.
Required parameters:
- Selector: The target window.
- ClippingRegion (Keep this field blank if a screenshot of the entire screen is needed): Defines the clipping rectangle, in pixels, relative to the UiElement, in the following directions: left, top, right, bottom. It supports both positive and negative numbers.
- Set the required Output parameter from the Properties pane
Output :
- Screenshot: The resulted screenshot. The field supports only Image variables.
- To save the taken screenshot, drag “Save Image” activity into the designer pane to save the screenshot to the specified location.
Input:
File Name: The full file path where you want to save the image, and its name.
Output:
Target Window:
Resulted screenshot:
Note: The advantage of using modern Take Screenshot activity (by enabling Modern Design Experience) is, both the actions of taking a screenshot and saving a image is clubbed into this single activity.