Forum Discussion

shaifali_pandya's avatar
shaifali_pandya
Occasional Contributor
11 years ago

FindChild fails to return expected object


'FullName' of the panel is - Sys.Browser("iexplore").Page("http://wsstage06/*/Areas/*/Ratings.aspx").Panel("container").Panel("main").Panel("maincontainer").Form("aspnetForm").Table(0).Cell(0, 0).Table(0).Cell(0, 0).Table(0).Cell(1, 0).Table(0).Cell(0, 0).Table("ctl00_MainContentRoot_ASPxMenu1")



Code to find the object is as follows -



splits the full name value into 15 pieces

first piece is initialised directly via myObj = Sys.Browser("iexplore")

after that in a loop myObj is initialised by finding the next piece

myObj = myObj.FindChild("Name", aqString.GetListItem(sFullNmPiece, i) )



This code works until the second last object i.e Sys.Browser("iexplore").Page("http://wsstage06/*/Areas/*/Ratings.aspx").Panel("container").Panel("main").Panel("maincontainer").Form("aspnetForm").Table(0).Cell(0, 0).Table(0).Cell(0, 0).Table(0).Cell(1, 0).Table(0).Cell(0, 0)

after this findchild returns empty object for Table("ctl00_MainContentRoot_ASPxMenu1")



(We are using Jscript with TestComplete version 10.10.752.7)



Please help resolve / understand the issue.


  • jose_pita's avatar
    jose_pita
    Super Contributor
    Try this:



    var obj = Sys.Browser("YOURBROWSER").Page("YOURPAGE").Find(new Array("PROPERTY1NAME", "PROPERTY2NAME"), new Array("PROPERTY1VALUE", "PROPERTY2VALUE"), 30, true)



    Use the object spy to check the properties you need in order to find the object correctly.

    You can use how many properties you want.

    I usually use "ObjectIdentifier" , "Name" and "VisibleOnScreen".