Code modules allow you to access screenshots of UI elements. This functionality supports image-based automation, where Ranorex Studio identifies items by comparing images.
Address a screenshot in code
To retrieve a screenshot of a repository item, use the following code structure:
Bitmap theScreenshot = myRepo.DemoApplication.TheCatInfo.GetmyScreenshot();
- Calls the repository according to the repository’s hierarchy, beginning with DemoApplication in this case.
- Calls the Info object of the repository item (this is necessary because only this class works with the following method).
- Calls the Get method to retrieve the screenshot.
Edit screenshots in code
You can also manipulate screenshots directly within your code. Ranorex Studio provides several classes for this purpose:
- Imaging
- Imaging.FindOptions
- Imaging.Match
- Imaging.Processing
For a complete list of capabilities, refer to the Ranorex Namespace section in the API documentation.