Access screenshots

You can also access screenshots of UI elements with code modules. This is useful for image-based automation, where UI items are identified by image comparison.

Note icon

Note

You can create screenshots manually or with Ranorex Studio’s ⇢ image-based automation capabilities.
The following screenshot shows the necessary code to address a screenshot of a repository item:
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.

tipp icon

Hint

You can also edit screenshots in code. This is accomplished with such classes as Imaging, Imaging.FindOptions, Imaging.Match, Imaging.Processing, and others. These are all described in the API documentation under the catetegory Ranorex Namespace.