Forum Discussion

rwhans007's avatar
rwhans007
New Contributor
10 years ago
Solved

ambiguous object

Hello, I am using TC 9.0 on a win2k3 machine (I know, a bit outdated). I am running into an ambiguous object. I know what uit means, but waht I do not understand is that it only happens once in a while. When I reboot the machine, everything is working fine for several runs.



some of the scripted lines this happens on:

Aliases.Desktop.Workstation.txtUserName.Keys(appUser);

Aliases.Desktop.Workstation.txtPassword.Keys(appPass);



When I replace with:

Sys.Process("ws32", 3).WinFormsObject("SystemLogin").WinFormsObject("username").Keys(appUser);

Sys.Process("ws32", 3).WinFormsObject("SystemLogin").WinFormsObject("password").Keys(appPass);



they work, or I can reboot and the old lines work. it is obviously a name mapping issue, but I am not sure what it can be.



I do not wish to replace all my code with the mapping bypass method, as this is a big script.



Anyone have any ideas what else I can try?





Thanks,

Ronald
  • Basically, you have 3 versions of ws32 process running and your alias/mapping does not specify an index like the full name you have listed. Test Complete does not know which process you want to work with. Specify an index or ensure that only one instance is running.



    Sys.Process("ws32", 3).WinFormsObject("SystemLogin").WinFormsObject("username").Keys(appUser);

                                    ^

                                    ^


                                    ^

                                    ^



3 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Basically, you have 3 versions of ws32 process running and your alias/mapping does not specify an index like the full name you have listed. Test Complete does not know which process you want to work with. Specify an index or ensure that only one instance is running.



    Sys.Process("ws32", 3).WinFormsObject("SystemLogin").WinFormsObject("username").Keys(appUser);

                                    ^

                                    ^


                                    ^

                                    ^



  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    When you reboot the duplicate ws32 processes are cleared from memory so running your test you'll now have only 1 process and now Test Complete no longer needs the index to determine which process you mean to work with. More than likely you'll want to create a function to close all other instances of this process when the script starts.



    JScript:



    terminateProcess("ws32");





    function terminateProcess(processName){


    var myProcessArray = VBArray(Sys.FindAll('Name','*' + processName + '*',1,true)).toArray();


    for (var process = 0;process < myProcessArray.length;process++){


     if (myProcessArray[process].Exists){


      myProcessArray[process].Terminate();


      }


     }


    }






  • rwhans007's avatar
    rwhans007
    New Contributor
    Ryan,



    Thanks for the reply. The thing that puzzles me is that a reboot solves the problem.

    Why does it work after a reboot for many runs and then suddenly it quits working?



    Ronald