Ranorex Spy - GDI capture feature | Ranorex Studio User Guide
Help CenterUser GuideRanorex Studio advanced

GDI capture feature

In rare cases, Ranorex Studio can’t 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.

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, we’ll explain the difference between non-GDI and GDI UI-element identification by way of a simple example in the Ranorex Studio Demo Application: the calendar.

In this chapter

    tipp icon

    Screencast

    The screencast “GDI capture feature” walks you through information found in this chapter.:

    Watch the screencast now

    Default, non-GDI UI-element identification

    We want to automate the calendar in the Demo Application. For this purpose, we need to identify the UI element for a specific day of a 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, e.g. 25 May.

    Non-GDI-based UI-element identification
    Result
    Result of non-GDI-based UI-element identification
    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 (i.e. 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 our 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.

    GDI capture configuration
    Now we can track the UI element once more.

    Click TRACK.
    Click a specific day in the calendar, e.g. 25 May.

    GDI-based UI-element identification
    Result

    The UI element is identified correctly based on the RawText adapter .

    Result of GDI-based UI-element identification
    The RanoreXPath shows that the date 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

    We recommend only adding single UI element classes to the GDI capture list. However, if you need to add an entire process (e.g. 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….

    GDI capture settings
    The GDI settings open.
    GDI capture list