Forum Discussion

von_bailey's avatar
von_bailey
Contributor
10 years ago

Can't get the FindChild command to work

01: function ViewAllTrayItems(theLink,browser,env,crBrowser,dWait)

02: {
03: theTrays=theLink.Panel("middle").Panel("middleInner").Panel("onboardingDeckContainer").Panel("cardDeck")
04: findTray=theTrays.Section("sbTray19").FindChild("Link",0,2)
05: if(findTray.Exists)
06:   {findTray.Click()}
07: else
08:   {Log.Error("Nope, didn't find it.")}

09: theTrays.Section("sbTray19").Link(0).Click()

 

The above code is supposed to find a link in Section("sbTray19") with the value of 0 in line 04.  Yet it does not do so.  The "the trays.Section("sbTrays19").Link(0).Click()" command in line 09 works just fine so the object does exist, I just cannot find it using the FindChild command.  I'd also like to have it use a varible with the "sbtray" aspect (i.e. "subtray*") of the code as the numbers may vary.   Can someone please give me some idea of what I am doing incorrectly?  

1 Reply

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    function ViewAllTrayItems(theLink, browser, env, crBrowser, dWait) {
        theTrays = theLink.Panel("middle").Panel("middleInner").Panel("onboardingDeckContainer").Panel("cardDeck");
        findTray = theTrays.Section("sbTray19").FindChild(["ObjectType","Name"],["Link", "Link*0*"], 1);
        if (findTray.Exists) {
            findTray.Click();
        } else {
            Log.Error("Nope, didn't find it.");
        }
        theTrays.Section("sbTray19").Link(0).Click();
    }