Forum Discussion

hunggsta's avatar
hunggsta
Occasional Contributor
12 years ago

AWTComponent has unique name each time tested app is ran...TC cannot find component.

I have been using Test Complete for awhile and just got into name mapping.  For my java application that I am testing, the AWTComponent name gets appended with a different ID number each time it is ran.  This makes test complete not able to find the object.



I have something like:



Sys["Process"]["javaw"]...["GPanel-133345"]



So the 133345 in ["GPanel-133345"] is not there the next time the tested app is ran.  Seems like a new identifier gets assigned and Test Complete cannot find it.



I've been stuck on this issue for a day and a half..so any help would be greatly appreciated.
  • Hey Hung,



    Try using wildcards:



    Sys["Process"]["javaw"]...["GPanel-*"]



    ...that is assuming that your test is a script?!...otherwise, you may be able to use a wildcard else where...
  • hunggsta's avatar
    hunggsta
    Occasional Contributor
    Hi Andrew,



    I just tried that and it doesn't find it still.

    thanks
  • What are you trying to do?



    Are you just trying to launch the app, or click something?
  • hunggsta's avatar
    hunggsta
    Occasional Contributor
    Trying to add some text to a Java Text Field on an already launched app.  When I record the script I get something like:



    var textfield = Sys["Process"]["javaw"]...["GPanel-133345"][Gjp"];

    textfield["Click"](300,7);



    I can run this script on the tested app and it will work.  But when I restart the tested app, the number changes for GPanel and it can't find it.



    I tried:



    var textfield = Sys["Process"]["javaw"]...["GPanel*"][Gjp"];



    and I get that it can't find the object GPanel*
  • When you use the Object Spy tool to find the properties of that field, do you get an 'ObjectIdentifier' value?



    You may have to identify that object using something more unique so that TestComplete always finds it
  • hunggsta's avatar
    hunggsta
    Occasional Contributor
    I just tried your suggestion and do not see the 'ObjectIdentifier' value.



    I saw a video where the demo-er used the 'ObjectIdentifier' value for websites...but for this Java app, I see nothing.
  • hunggsta's avatar
    hunggsta
    Occasional Contributor
    Nothing at all.



    I tried using name maps and using the '*' for the number I see, but it won't find the object after the java app is restarted....very frustrating.



    thanks for your help
  • hunggsta's avatar
    hunggsta
    Occasional Contributor
    Tanja,



    Thanks for pointing me in the right direction!  The extended search info worked!