Forum Discussion

Kostja's avatar
Kostja
Contributor
9 years ago
Solved

wait for child to be loaded

Hello everybody,

 

i got a question regarding web testing.

 

I have my page which consists full of widgets which can be added or deleted. Since the structure of the page is dynamic and always changes name mapping is only to a certain degree useful, so i mostly work with the FindChild method and everything works fine.

 

Within the widgets i can configure some settings and after i click on the Save-Button it starts to load a Chart.

 

Now my question is: Since i have to wait for the Chart, cause i want to verify the creation of the chart, is there another method to wait for the fully loaded content of an object then aqUtils.Delay? It works with aqUtils.Delay partly, but im not satisfied with the process and its not consistent, because the load time often varies. page.Wait() doesn't help either. The page is loaded but the content of the widget still needs its time and so it happens to failure very often.

  • Hi,

     

    See http://support.smartbear.com/viewarticle/55112/ (or, even better, http://support.smartbear.com/viewarticle/66720/) for the description of the .FindChild() method.

    In your case, you should use either just

    var GVCntnt = MyDashCol1.FindChild('contentText','Configuration of this*Circular Gauge*',20);

    to search for the content of the widget, or, if this search is not accurate enough, then the code must be like that:

    var GVForm = MyDashCol1.FindChild(FormPropArray,FormValueArray,​20);
    var GVCntnt = GVForm.WaitChild('contentText','Configuration of this*Circular Gauge*', 15000);

     

    And yes, as the widgets and their data are obtained asynchronious after the main page has been loaded, the page.Wait() does not work in this case and the only reliable method that works is to search for the required child within some time interval (exactly what .FindChildEx() method does) and either continue with the found object or fail with the error if the sought for object did not appear within some reasonable timeout. (Well, probably this is not a functional problem if some object cannot be loaded within, say, 30 seconds, but obviously something that most of web users will not accept if not warned previously.)

4 Replies

    • Kostja's avatar
      Kostja
      Contributor

      Thank you very much for the reply.

       

      I tried it with the WaitChild method, but when i use a variable it says 'types incompatible'.

       

      For example...this works:

       

      var GVForm = MyDashCol1.FindChild(FormPropArray,FormValueArray,20);
      
      GVForm.WaitChild('Panel(3)', 15000);

      this doesn't::

       

      var GVForm = MyDashCol1.FindChild(FormPropArray,FormValueArray,20);
      
      var GVCntnt = MyDashCol1.FindChild('contentText','Configuration of this*Circular Gauge*',20);
      
      GVForm.WaitChild(GVCntnt, 15000);

      GVForm is the widget itself and GVCntnt/Panel(3) is the content of the widget.

       

       

      The problem is a definition with just 'Panel(3)' is not accurate.

       

      Is it possible to use the WaitChild method like the second example or a similar way?

       

      Thanks for help in advance.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        See http://support.smartbear.com/viewarticle/55112/ (or, even better, http://support.smartbear.com/viewarticle/66720/) for the description of the .FindChild() method.

        In your case, you should use either just

        var GVCntnt = MyDashCol1.FindChild('contentText','Configuration of this*Circular Gauge*',20);

        to search for the content of the widget, or, if this search is not accurate enough, then the code must be like that:

        var GVForm = MyDashCol1.FindChild(FormPropArray,FormValueArray,​20);
        var GVCntnt = GVForm.WaitChild('contentText','Configuration of this*Circular Gauge*', 15000);

         

        And yes, as the widgets and their data are obtained asynchronious after the main page has been loaded, the page.Wait() does not work in this case and the only reliable method that works is to search for the required child within some time interval (exactly what .FindChildEx() method does) and either continue with the found object or fail with the error if the sought for object did not appear within some reasonable timeout. (Well, probably this is not a functional problem if some object cannot be loaded within, say, 30 seconds, but obviously something that most of web users will not accept if not warned previously.)