Forum Discussion

sushma_n's avatar
sushma_n
New Contributor
14 years ago

TestComplete is unable to identify the Tab within a Delphi Application uniquely

Hi,



We are automating our Delphi Application using TestComplete.



TestComplete is not able to uniquely identify the Tab which is present on a Frame, in that, the Tab is not being highlighted in the Object Browser.



Through our script, we have to click on a particular Tab which resides within the Frame. We have used the FrameObject.Click(x,y) where x and y are the co-ordinates. This is doing the click action on that particular tab, depending on the co-ordinate values supplied.



However, we wanted to know if there is an alternative method to make TestComplete click on the Tab within the Frame, instead of providing the co-ordinates as we think that this is not a very good way to do it.



Please let us know.



thanks and regards,

Sushma.
  • Sushma,


    Most likely, TestComplete does not recognize the tab control you are using as a tab control. In this case, it uses clicks with coordinates to simulate use actions.  If a control was recognized as a tab control, TestComplete would use the ClickTab method to simulate the tab selection.


    Delphi has two standard controls that provide the tab functionality: TPageControl and TTabControl. To reproduce the issue, I created a test application that shows controls of both types in a frame. TestComplete recognized both of these controls as tab controls in that application. So, I suppose that you are using a custom tab control. In this case, it's OK that you don't see individual tabs in the Object Browser (as far as I can see, only the tabs of TPageControl are shown as items in the Object Browser, the tabs of TTabControl are not shown).


    To command TestComplete to recognize your control as a tab control, you need to change some settings of your test project:


    *  Launch your application.

    *  Switch to the Object Browser and find your tab control there.

    *  Find the WndClass property on the right and memorize (or write down) its value.

    *  Switch to the Project Explorer[ panel, right-click your test project there and choose Edit | Properties from the context menu. This will open the project editor and activate the editor's Properties page.

    *  Select Object Mapping on the left of the page. This will open the Object Mapping settings for editing on the right.

    *  Choose the Win32 Controls and Windows | Tab control object category and add the class name of your control to the list (see the attached image).

    * Select File | Save from the main menu to save the changes.


    Now, TestComplete will recognize your control as a tab control and will use the ClickTab method for tab selections.

  • sushma_n's avatar
    sushma_n
    New Contributor

    Hi Alex,


    I edited the ‘Object Mapping Settings’ for Win32 Controls and Windows | Tab control’ Category for that Project and added the WndClass of the Frame containing the Tabs.


    Please have a look at the attached Screenshot TabControlObjectMappingSetting.png.


    When I did this, I found ‘ClickTab’ Method in the ‘Actions’ Section of the Frame Object’s ‘Object Properties’ Window, which was not available before adding the Class Name of the Frame containing the Tab. I have attached another Screenshot ObjectPropertiesForTabControl.png


    However, when I tried to make use of the ‘ClickTab’ Method, with the Tab Index, the Script did not run successfully. TestComplete was not able to recognize the Tab Control within the Frame. Also, I verified this, by recording the Script for clicking on the Tab. TestComplete used FrameObject.Click(x,y) again, in spite of adding the Class Name of the Frame to that ‘Object Mapping Settings’ for ‘Win32 Controls and Windows | Tab control’ Category.



    In addition, I have attached a Snapshot of the Frame containing the Tabs FrameContainingTabs.png.


    Please let me know if am missing anything.


    Thanks for your help.


    Regards,


    Sushma.
  • Sushma,


    You said that you added the frame class name, while you need to add the class name of your tab control. Please check the settings and try again.


    As far as I can see, you are working with the TovcNotebook control. If the Object Mapping settings don't help, you can make the tested application Open and use the control's PageIndex property to activate the needed tab.

  • sushma_n's avatar
    sushma_n
    New Contributor
    Hi Alex,



    I tried by setting the Frame Object's PageIndex Property to click on the required Tab. It worked perfect.



    Thanks for the help.



    Regards,

    Sushma.
  • Hi Alex,



    I am working with an Delphi application and i came across trzPageControl object where i need to click a particular tab. I tried the above 2 methods but it didn't resolve my issue. Could you suggest few more methods to resolve this.