Ask a Question

"WaitChild" ends up in error. Need help!

royd
Regular Contributor

"WaitChild" ends up in error. Need help!

The test requires for the page in question to load within 5 seconds otherwise, the set should fail. I am using WaitChld to achieve that. Although the page is loading in a couple of seconds, the test stops with an error message "The object does not exist. See Additional Information for details."

 

 

  let browser = Sys.Browser("iexplore");
  let page = browser.Page("*transcripthcdev.lan/EngagementPlatform/iforms");
  let panelNavSteps = pageiForm.FindChild("idStr", "nav-steps", 15);


  if (panelNavSteps.WaitChild("Link(\"firstLink\")", 5000).Exists){
    Log.Picture(page, "Patient PPT forms page loaded.");
  }
  else{
    Log.Warning("PPT forms page did not load in 5 seconds.")
  }

panel.png

 

 

Just discovered that both "Admission Acknowledgement and General Consent for Treatment" and the "PHI, Third-Party Payer Notice, Advance Directive" has the same name ("Link("firstLink")"). Moreover, "Form List",  "Selected Form Sectiion" and The "Selected Form Signatures" also have the same name ("Link(0)")! This may be the cause of my troubles?

 

I really appreciate any help.

 

Thanks.

6 REPLIES 6
tristaanogre
Community Hero

Re: "WaitChild" ends up in error. Need help!

In this case, instead of "WaitChild", try using FindChildEx. (https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/common-for-all/findch... This will allow you to more finely tune what object you're looking for by more properties than just the name.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
royd
Regular Contributor

Re: "WaitChild" ends up in error. Need help!

Hi Robert, good to hear from you! I have learned so much from you! Thank you. 🙂

 

As per your advice, I have tried FinChildEx, here is my code:

 

  let formPanel = page.FindChild(["ObjectType", "idStr"], ["Form", "main-content"], 15);
  let sinatureArea = formPanel.FindChildEx(['tagName','idStr'],['CANVAS','signature-canvas*'], 20, true, 10000);

  if (sinatureArea.Exists){
    Log.Picture(page, "Patient PPT forms page loaded.");
  }
  else{
    Log.Warning("PPT forms page did not load in 5 seconds.")
  }

canvas.png

 

I get an error, I even increased the time to 10 sec, no luck!

"You are trying to call the "FindChildEx" method or property of an object that does not exist."

 

Any idea?

 

Thanks.

 

tristaanogre
Community Hero

Re: "WaitChild" ends up in error. Need help!

Yup.. "FindChild" returned an empty object for formPanel.  So, since it couldn't find formPanel, any code after that which tries to use formPanel will fail.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
royd
Regular Contributor

Re: "WaitChild" ends up in error. Need help!

Any suggestion how to address that?

 

Just checked, formPanel is 10 level deep on that page. Do I changed it to -

 

 

   let formPanel = page.FindChild(["ObjectType", "idStr"], ["Form", "main-content"], 30);

 

Still no go! 

 

Thanks.

 

Dave

tristaanogre
Community Hero

Re: "WaitChild" ends up in error. Need help!

Well, the "30" says to check 30 levels deep.  So, if it didn't find it at 15, it won't find it at 30.  The problem is either in the properties you're using for searching or, perhaps, another timing issue where something prior to trying to find formPanel isn't complete yet and so formPanel is not available to be found.

It might be helpful to see the full code including the steps and actions leading up to "let formPanel =".  We might be able to determine a bit better as to what other checks you might need to do.  It all comes down to a) proper object identification and b) proper code to wait for those objects.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
shankar_r
Community Hero

Re: "WaitChild" ends up in error. Need help!

Can you try using Find?

 

   let formPanel = page.Find(["ObjectType", "idStr"], ["Form", "main-content"], 30);

Also, you may want to check only the idStr is enough to find your object, if not find more reliable properties and use Array get your object. 

 

I always use Exists before trying it is Methods like below,

 

  let formPanel = page.FindChild(["ObjectType", "idStr"], ["Form", "main-content"], 15);

if(formPanel.Exists){ let sinatureArea = formPanel.FindChildEx(['tagName','idStr'],['CANVAS','signature-canvas*'], 20, true, 10000); if (sinatureArea.Exists){ Log.Picture(page, "Patient PPT forms page loaded."); } else{ Log.Warning("PPT forms page did not load in 5 seconds.") }
}

Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

cancel
Showing results for 
Search instead for 
Did you mean: