Forum Discussion

Neel's avatar
Neel
Occasional Contributor
8 years ago

I'm not able interact with the object stpContent

Code which is not working

 

I'm not able to interact with stpcontent, below is the jscript for it

 

Sys.Process("application_name").WinFormsObject("frmApplication").WinFormsObject("stpContent").WinFormsObject("flpButtons").WinFormsObject("cmdCancel");

 

Code which is working

 

However, when we try to run the same code with Aliases it works fine

 

Aliases.<application_name>.frmApplication.stpContent.flpButtons.cmdCancel.ClickButton()

9 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    OK... so... what EXACTLY is not working? What errors, warnings, behaviors, etc., are you experiencing in the first example that you are not in the second?

     

    Generally speaking, the NameMapping/Aliases feature of the system does a lot more in the line of identifying objects using multiple parameters. So, it's possible the criteria for finding that component is more robust through the Aliasing than it is through the Sys.... designation.  I'm not certain, but I think that the Aliases also does a bit better in handling "waiting" for components than just going through the "normal" designation.

     

    However, the solution to your specific problem depends somewhat on the actual problem you are experiencing... so, thje more detail, the better. :)

     

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor
        Concerning the thread you posted... Aliases is not a "function" of TestComplete versus TestExecute... it has to do with the project you are running. Based upon your screenshot, you are mapping your objects using namemapping which means your project has Aliases... but you haven't responded/resolved whether or not the project has been properly transferred over to the machine along with the appropriate namemapping file. If not, then yes, you will get the "Aliases" not supported error.

        That said... if you're getting an "object does not exist" error, that usually points to an issue in timing where your scripts are attempting to interact with an object that has not been instantiated. Keep in mind that automated tests playback a LOT faster than human interaction... that, and human interaction has this automatic reflex to not try and do something with an object that has not yet been presented.

        Read up on using WaitNNN methods like WaitChild or WaitAliasChild to actually check to see if your object exists before you attempt to click on it or interact with it.