Forum Discussion

nem's avatar
nem
Occasional Contributor
15 years ago

Problem with FindChild method

Hi,



Does anyone have any ideas why I have problems with FindChild method described below:



Full Item name is the following:

Sys.Process("iexplore").Page("*EdProf*").Form("aspnetForm").Table("Outermost").Cell(1, 0).Table("ctl00_PageArea_RecordTable1_tblData").Cell(1, 0).Textbox("ctl00_PageArea_RecordTable1_Search1")



I try to verify whether the object exists with the following code:

if (this.oCurrentTable.FindChild("idStr","*_Search"+(iColsNumber+1)+"", 3).Exists)



where



this.oCurrentTable == Sys.Process("iexplore").Page("*EdProf*").Form("aspnetForm").Table("Outermost").Cell(1,
0).Table("ctl00_PageArea_RecordTable1_tblData")



iColsNumber = 0



The object does actually exist; but condition returns false. All necessary TC settings were applied.

I guess the code became unworkable after we moved to TC8



Thanks,

Aliaksei
  • Hi Aliaksei,


    Set a breakpoint on the problematic line and check the actual property value which is passed to the FindChild method call. If the value is correct, try using the following method call and check whether this helps:

    if (this.oCurrentTable.FindChild("idStr","*_Search"+(iColsNumber+1)+"*", 1000).Exists)

  • nem's avatar
    nem
    Occasional Contributor
    Thanks for your reply, Allen,



    The issue was resolved after changing Tree model from "Hybrid" to "Tree" (It was the only thing I did). Not sure why; but it works now.



    Regards,

    Aliaksei
  • Hi Aliaksei,


    Using the Tree model for new tests is a good solution, since the Hybrid model contains both DOM and Tree branches for compatibility purposes. The Tree model is faster.