Forum Discussion

SuperTester's avatar
SuperTester
Contributor
5 years ago

Find child - comSafe Array

Hello, 

 

I'm using the wnd caption with a find child statement to find a window in our software. The Find Child statement is returning the window as a comSafeArray object. I'm confused about this result. Properties of the object are now part of elements of the window. Is there an issue with how I used the findChild statement? 


var property = "WndCaption"
var objWnd = ritSysObj.FindAllChildren(property,strCaption,3)
Log.Picture(objWnd)

 

 

 

Thanks in advance! 

  • Can you please try once with Find instead of FindAllChildren

    var objWnd = ritSysObj.Find(property,strCaption,3)

     

    Please let me know whether that works.

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

    Can you please try once with Find instead of FindAllChildren

    var objWnd = ritSysObj.Find(property,strCaption,3)

     

    Please let me know whether that works.

    • SuperTester's avatar
      SuperTester
      Contributor

      Hello, 

       

      The "Find" command worked! Much appreciated! 

       

      I'm guessing that I was encountering some king of process  hierarchy issue. From what I understand, FindChild searches child objects while Find also searches the Tested object, or System process object in my case. 

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    What scripting language you are using?

    If it is JScript, then you should use .toArray() (see documentation for more details).

    I.e.:

    var objWnd = ritSysObj.FindAllChildren(property,strCaption,3).toArray();