In rare cases, Ranorex Studio cannot identify UI elements of an AUT correctly. This applies to certain technologies such as VB6, MFC, and older Delphi versions. In these cases, you can use the GDI (graphic device interface) capture feature to identify these elements correctly.
Ranorex Studio supports both GDI and GDI+. You have to enable GDI+ recognition manually. This is explained at the end of this page.
The GDI capture feature is part of Ranorex Spy. You can access it from an element’s context menu in the element tree browser.
On this page, you can find the difference between non-GDI and GDI UI-element identification by way of a simple example in the Ranorex Studio Demo Application: the calendar.
The screencast GDI capture feature walks you through information found in this chapter:
Default, non-GDI UI-element identification
Let's automate the calendar in the Demo Application. For this purpose, you need to identify the UI element for a specific day of the month.
Let’s identify the element by using the track function in Spy:
-
Start Ranorex Spy and click TRACK.
-
In the Demo Application, click a specific day, for example, May 25.
Result
-
The RanoreXPath of the new UI element shows that not a specific day, but the entire calendar has been identified.
-
In the element tree, the UI element also has the adapter type DateTime (for example, a calendar).
-
The screenshot for the UI element also shows the entire calendar, and not just the 25.
Enable GDI capture
As default UI element identification didn’t work in this case, we need to enable GDI capture. To do so, we add the incorrect UI element to the GDI capture list. In this case, this will allow Ranorex Studio to identify the correct UI element based on the RawText adapter class.
-
In the element tree, select the UI element you want to be handled by GDI capture.
-
Right-click it and click Add class name to GDI capture list.
-
Click OK to confirm the info dialog.
Now, you can track the UI element once more.
-
Click TRACK.
-
Click a specific day in the calendar, for example, May 25.
Result
The UI element is identified correctly based on the RawText adapter.
-
The RanoreXPath shows that the date of a specific day, and not the entire calendar, has been identified.
-
In the element tree, the UI element has the adapter type RawText.
-
The screenshot now shows the UI element for the specific day instead of the entire calendar.
Add a process to the GDI capture list
It is recommended to only add single UI element classes to the GDI capture list. However, if you need to add an entire process (for example, for legacy reasons), you can do so in the GDI capture settings, which is explained in the next topic.
GDI capture settings
The GDI capture settings display all added processes and class names. This is also where you can add processes and class names in bulk or by specifying a regular expression. You can access the GDI capture settings from the Settings dialog in Ranorex Studio or Spy.
-
Click SETTINGS….
-
In the General tab, click GDI capture settings….
-
The GDI settings open.
Enable GDI+
GDI+ recognition is turned off by default. If required, enable it manually under Settings > Plugins > Capture GDI+ text.