Forum Discussion

Oferv's avatar
Oferv
Super Contributor
14 years ago

WaitAliasesChild cannot found existing child object

Hi,

i'm using WaitAliasesChild in order to find a child object that has just been added to the application and TC is unable to find it.the name of the new object as display in the object spy is as follows ("TextBlock", AddedDocumnt, 1). so my WaitAliasesChild  looks like this



Aliases["DesktopMainWindow"]["NavigationalPaneTOCTree"]["WPFObject"]("TreeViewItem", "", UpdatedTab)["WaitAliasChild"](("TextBlock", AddedDocumnt, 1), 10000)["Exists"]



UpdatedTab - is the tab where the new document was updated which it's randomal

AddedDocumnt - is the document name that was updated



is there a problem with that or should it work according to what i wrote?



Thanks
  • sbkeenan's avatar
    sbkeenan
    Frequent Contributor
    Hi Ofer



    I'm not too sure about the syntax of your chosen script language, but the problem you are experiencing is most likely due to the way in which you have used the WaitAliasChild method.  As far as I know, it accepts two parameters, the child name and the wait time, but your statement looks like it is supplying the method with three parameters.  The method should read along the lines of:



    ....WaitAliasChild("<child name>", <wait time>)...



    You should also check to ensure that all the previously listed objects in the statement have been correctly mapped and are available to TestComplete before it executes the WaitAliasChild part, for example, if the ["WPFObject"] isn't available, then nothing after that will be available.   So, it may be that you need to introduce the WaitAliasChild method sooner in order that TestComplete waits until a previous object becomes 'visible'



    Hope this helps.



    Regards

    Stephen.




     




    Posts 162




    Hi,

    i'm using WaitAliasesChild in order to find a child object that has just been added to the application and TC is unable to find it.the name of the new object as display in the object spy is as follows ("TextBlock", AddedDocumnt, 1). so my WaitAliasesChild  looks like this



    Aliases["DesktopMainWindow"]["NavigationalPaneTOCTree"]["WPFObject"]("TreeViewItem", "", UpdatedTab)["WaitAliasChild"](("TextBlock", AddedDocumnt, 1), 10000)["Exists"]



    UpdatedTab - is the tab where the new document was updated which it's randomal

    AddedDocumnt - is the document name that was updated



    is there a problem with that or should it work according to what i wrote?



    Thanks
  • Oferv's avatar
    Oferv
    Super Contributor
    HI,



    i copied the wrong line you are right here is the correct one



    Aliases["DesktopMainWindow"]["NavigationalPaneTOCTree"]["WPFObject"]("TreeViewItem", "", UpdatedTab)["WPFObject"]("TreeViewItem", "", "*")["WPFObject"]("Grid", "", 1)["WaitAliasChild"](("TextBlock", AddedDocumnt, 1), 10000)["Exists"]



    the problem i'm facing now is that the wildcard (in bold) is not recognized the original identification uses a number there but since the number is irrelevant for me i want to use "*" instead but it looks like TC can't recognize this object because of the wildcard.



    why is that?



    thanks
  • sbkeenan's avatar
    sbkeenan
    Frequent Contributor
    Hi Ofer



    It may be that WPFTreeViewItem doesn't accept wild cards.  I haven't worked with such controls myself, but it may be that you need to use the Item property to specify a specific item.  See WPFTreeViewItem Object in the help files.



    I still think, however,  that the WaitAliasChild section of your statement is wrong as it looks like you are passing 3 parameters rather than 2.  If you refer to the help files, for the WaitAliasChild method, you can see an example of its use and this can be displayed in your scripting language, which should give you a better understanding of its use.



    Regards

    Stephen.
  • Oferv's avatar
    Oferv
    Super Contributor
    Hi Stephen,



    It's two you probably didn't noticed,i have bold it for you



    Aliases["DesktopMainWindow"]["NavigationalPaneTOCTree"]["WPFObject"]("TreeViewItem", "", UpdatedTab)["WaitAliasChild"](("TextBlock", AddedDocumnt, 1), 10000)["Exists"]



    1.("TextBlock", AddedDocumnt, 1)

    and

    2.10000



    but,still i would like someone from the SmartBear support team to take a look at this maybe they have an answer



    Thanks
  • irina_lukina's avatar
    irina_lukina
    Super Contributor

    Hi Ofer,


    why is that?


    This situation is caused by the fact that TestComplete doesn't allow using wildcards instead of indexes. For more information, see the description of the WPFObject method and its parameters.


    One more note: please clarify why you cannot specify a numeric value of the index parameter in this method.


    Thanks.

  • Oferv's avatar
    Oferv
    Super Contributor
    Hi Irina,



    actually i manage to get over this problem by taking the childcount from the object after its creation and that solved my problem.

    But now,since i'm searching for an added file name i'm using this as a code line:



    Aliases["DesktopMainWindow"]["NavigationalPaneTOCTree"]["WPFObject"]("TreeViewItem", "", UpdatedTab)["WPFObject"]("TreeViewItem", "", ChildCount - 1)["WPFObject"]("Grid", "", 1)["WPFObject"]("TextBlock", "AddedDocumnt*", 1)["Exists"]



    why i can't use wildcard here?this is not an index.



    Thanks
  • Oferv's avatar
    Oferv
    Super Contributor
    Ok Irina thanks for the help i solved that one