Forum Discussion

lbyrne's avatar
lbyrne
Contributor
11 years ago

Unable to find objects Test Complete 10

I am new to Test Complete



At one point, the old scripts work. 

I am getting many objects does not exist errors.



I am not using name mapping

Please explain



Old code


Call Sys.Process("HSP.Meditrac").mdiMeditrac.StripMainMenu.Click("Help|About Meditrac...")





New code after re-recording

Set
mdiMeditrac = Sys.Process"HSP.Meditrac").WinFormsObject("MDIForm")



Call mdiMeditrac.StripMainMenu.Click("Help|About MediTrac...")

Why was WinFormsObject("MDIForm") added?



I have just started to review a few scripts and I see this as an issue in many scripts and it causes multiple unable to find objects when I run the project




 




  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Possibly check

    Tools>Options>Engines>Recording> Do not generate variables

    and

    Tools>Options>Engines>Recording> Smart variable names
  • I checked the settings and under Script recording Smart variable names is checked.



    I don't understand your reply.



    The old code has a variable called x set to the following

    Sys.Process("HSP.Meditrac").mdiMeditrac.StripMainMenu.Click("Help|About Meditrac...")



    I get object does not exist. When I put a breakpoint in and click on object spy the object is as follows

    Sys.Process("HSP.Meditrac").WinFormsObject("MDIForm").StripMainMenu.Click("Help|About MediTrac...")



    Why has it changed?  WinFormsObject("MDIForm"). has been added



    Thanks





  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    mdiMeditrac was possibly either a variable of WinFormsObject("MDIForm") or an alias/name mapping of WinFormsObject("MDIForm"). This could change if you then record a different script using different recording options or if you deleted the mapping.



    Could also be that you had an extension disabled.

    Ex:

    I have two objects that are the same, but notice I do not have to include the VCLObject (or in your case WinFormsObject) reference in the fullname.





    Sys.Process("ProfitNet").VCLObject("frmProfitNet").VCLObject("pcMain").VCLObject("tsDetail").VCLObject("TframeDetailLine1").VCLObject("btnRecOnePO").Click();

     


    Sys.Process("ProfitNet").frmProfitNet.VCLObject("pcMain").VCLObject("tsDetail").VCLObject("TframeDetailLine1").VCLObject("btnRecOnePO").Click();

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor

    Maybe not so good at explaining this. Here is another example of what you may be seeing.

    Generates many errors as you say:

    var xyz = Sys.Process("ProfitNet").VCLObject("frmProfitNet");


    Sys.Process("ProfitNet").xyz.VCLObject("pcMain").VCLObject("tsDetail").Click();



    Works:


    var xyz = Sys.Process("ProfitNet").VCLObject("frmProfitNet");


    xyz.VCLObject("pcMain").VCLObject("tsDetail").Click();




  • I understand what you are saying. At one point mdiMeditrac was defined. Now do you think the mapping was lost when this was converted from TestComplete 9 to Test Coomplete 10. Where do you think that was defined at one point?

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    "...do you think the mapping was lost when this was converted from TestComplete 9 to Test Coomplete 10."



    I couldn't speculate on that. If you keep backups of your scripts I'd comepare them to the previous version. At first glance I would assume that part of your script was modified with replace all, but maybe someone else has a different theory on this.



    "Where do you think that was defined at one point?"



    If you were using the recorder it was probably in your procedure at one point as a variable or name mapping.



  • I looked at the old versions of the scripts and they it is not defined in there.

    If the project utilized Name Mapping wouldn't I find Name Mapping listed under the project? I see that for other projects but not the one I mentioned.



    I am not too familiar with Name Mapping. I have to do some reading.



    Thanks for your help. If I see the Name Mapping folder what should I look at?



    How does the Name Mapping tie into the script files?



    Thanks for any information you can provide
  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    "If the project utilized Name Mapping wouldn't I find Name Mapping listed under the project?"



    Yes that is correct.


  • Question - the code mentioned below is one of the statements where I get object not found. This code is part of project that ran successfully in Test Complete 9 in a windows XP environment. When I run in Test Complete 10 in a WIndows 8 environment I get the object not found.

    splitContainer.SplitterPanel.xmlStyleSheet.tlpXMLBrowser.wbXML.WebBrowserBaseNativeWindow.ShellDocObjectView.browser.wait



    Do you think it is a windows issue or a test complete issue



    If I comment out, the log is affected.

    I really don't know why that code is in there.



    Also wait is not a valid method.



    Any suggestions? I just took over a project suite that needs to be evaluated. I am running into many objects not found. Trying to determine what could be the issue



    Thanks

    splitContainer.SplitterPanel.xmlStyleSheet.tlpXMLBrowser.wbXML.WebBrowserBaseNativeWindow.ShellDocObjectView.browser.wait


  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    If you updated from a fairly old version of IE I believe that would have caused this.

    As mentioned in this post.

    Compare the object hierarchy of an object in the previous browser version to that of an object in the new browser version to see the differences.

    If this isn't a browser you can still compare object hierarchy or FullName from version to version.

    Check the Object Browser and Object Spy

    Hope that helps!