Forum Discussion

dmitri_1's avatar
dmitri_1
Occasional Contributor
12 years ago

Trouble With Certain Screen Objects

Hi,



I have started using testComplete recently, and it does look like very powerful software but I am having some annoyances, and it would be good if I can find a proper way of doing things.



In my java application there are 'tabs' to access different functions (like calendar, reports, help tab, admin tab, etc).

When using object spy you cannot select these tabs as separate objects, you can only select the window that surrounds them and then click on an x/y coordinate.



Each time the application quits/starts it remembers the last tab you were on. So if I make a recording of a test and start on tab 1, then switch to tab 2 and quit. The next time the test runs it fails. This is seems to be because you are on a different tab and you have a different mainTabPane selected and thus it fails to click on a specified tab (unless you first switch to the tab that you were originally on when you recorded your click).



If someone has run into similar issues or can shed some light into how I can switch 'tabs' easily from any tab to any tab, that would be really helpful. I have attached image (it's not visible but I have the target point on the 'Admin' tab).









5 Replies


  • Hi Dmitri,


     


    I suppose selecting a tab by its name should resolve the issue when a wrong tab is selected. However, judging by the screenshot, TestComplete cannot recognize objects inside your app. What kind of application are you testing (VCL, VB, etc.)? Please refer to the "Open Applications - Overview" article to learn the ways to make TestComplete treat your application as Open.


     

  • dmitri_1's avatar
    dmitri_1
    Occasional Contributor
    It is a java app, it has the 'open' icon in the object browser.



    TestComplete can recognise most of the objects inside it, just not those tabs...



    I don't see a separate object for each tab, hence the dilemma of being able to select them by name or otherwise.

  • Hi Dmitri,


     


    It looks like a third-party tab control is used in your application that doesn't have full support in TestComplete. I suggest that you try doing the following:


    1. Check whether the control is inherited from a control that is specially supported by TestComplete (for example, from the JTabbedPane control). If it is, use the Object Mapping feature to make TestComplete treat the control as a supported control.


     


    2. If the control isn't inherited, you can use the approaches listed in the "Improving Object Recognition" article to make TestComplete recognize your tab control.


     


    3. If none of the above approaches help, you will need to use native properties and methods to test the control. The "Accessing Native Methods of Java Objects" article contains a detailed description of this approach.


     

  • dmitri_1's avatar
    dmitri_1
    Occasional Contributor
    Well I have tried reading those articles and find them a bit too technical and hard to follow.



    You CAN map the objects, but again the problem is the dynamic nature.



    The parent is - SwingObject("MainTabPane", "Help", 0)

    And each of the tabs are shown below it.



    But this parent changes to say - SwingObject("MainTabPane", "Admin", 0)



    When you switch tabs... 



    Attaching screenshot of my mapped objects for 2 tabs.



    Does that mean I need some sort of if/case statement to say if exists (or if I currently have selected) tab 1, then click this object, otherwise click a different one.







  • dmitri_1's avatar
    dmitri_1
    Occasional Contributor
    Tried using If...Then, Else statements.



    This also didn't work unfortunately.



    If i understood it correctly, the if condition simply cannot evaluate if the element is not there, thus it can't continue onto the Else.



    Attaching screenshot of the setup.





    Basic idea is again - IF you are on a particular tab THEN click the desired tab. ELSE just continue with the test.

    Also can you keep chaining ELSE IF's together?

    Would have been easier if you guys just had a case statement which vbscript has...