Forum Discussion

naveen_vastare's avatar
naveen_vastare
Occasional Contributor
14 years ago

Any suggestions for testing web application which is developed using ExtJS, preferably with TestComplete?

Our application was developed using ExtJS, so what method we can use to automate  ExtJS web application ?



Thanks for the help



Naveen



 

9 Replies

  • Hi,


    It doesn't matter how exactly your web application is developed. TC works with all types of web pages via a web browser in the same way. See the Testing Web Applications help topic.

  • I'm also automating ExtJS web application with TestComplete.


    ExtJS controls can be handled as any other. 


    You may use Find or FindAll methods to get them by properties that are not changed dynamically, or create your own functions to search for necessary web elements, or  to wait until they will appear. I most cases I can obtain necessary web element just by its classame (excluding dynamic part) and tag name.

  • naveen_vastare's avatar
    naveen_vastare
    Occasional Contributor

    Thanks for the suggestion, I have automated by extracting unique class and object ID


     


    How do I wait for the web page to get load now ? now I am facing problem here …I don’t want to use BuiltIn.Delay Function


     



    Pls give some sample code for an application which is developed in ExtJS to wait for page to download the elements completely




    Thanks

    Naveen

  • Hi,



    As Pavel suggested above, use the Find method to check whether a specific object exists on your page. Find the object which appears when the page is loaded and wait for this object. Also, see the "Waiting For Page" help topic.
  • naveen_vastare's avatar
    naveen_vastare
    Occasional Contributor

    Thanks for Reply


     


    I have used the below function to achieve my goal …but WaitProperty function is always returns false


     


    I have used other method to wait for the page – wait child and others


     


    Please let me know how to use WaitProperty method ? need some example


    Please find the sample code ----




     



     



    'parentPageObject - Page Object reference

    'PropertyName = Array("className")

    'PropertyValue = Array(" x-panel x-panel-noborder x-border-panel")


    Call VerifyPageDownloadForClassObject(PageObject,PropertyName,PropertyValue)




    'Function

    Sub VerifyPageDownloadForClassObject(parent,PropertyName,PropertyValue)


          'For Handing Exceptions

          On Error Resume Next

          VerifyPageDownloadForClassObject = False

          If  parent.Exists = False Then

              Log.Error("Error in VerifyPageDownloadForClassObject: Parent Object does not exists - Parent URL "+parent.url+" and looking for child - "+childStr )

          End If

        

      

                iteration = 1  'Iteration for finding each child

                Set parentObj = parent

                flag = False  ' Set the flag as true before each loop

                Do

                       

                        flag = parentObj.WaitProperty(PropertyName, PropertyValue, W_15SEC)



                        If flag = True Then

                            'Child found - so - Re-set parentObj with the childObject

                             parentObj.wait

                             VerifyPageDownloadForClassObject = True

                        Else

                            iteration = iteration + 1

                            If iteration >= MAX_ITERATION Then

                              Log.Error("Max Iteration hit, while waiting for child:" + PropertyValue +"iteration : "+CStr(iteration) + "MAX_ITERATION : "+CStr(MAX_ITERATION)+" - Parent URL "+parent.url+" and looking for child - "+PropertyValue )

                            End If 

                        End If

                    Loop Until flag = True           

                    

         

    End Sub

     


  • Hi,



    You should specify the PropertyName and PropertyValue as a strings in waitproperty method.


    But you won't be able to access childs in this way. You'll be just waiting untill a specified property of the object will obtain the specified value.


    As for waiting for a specific exjs control to appear I am using function like the following (JScript) to get it by its up to 3 properties:


    You may convert it to VBS and pass arrays of properties and values to it instead of strings (I guess you won't need any array conversion like it is done in JScript with ConvertJScriptArray function)


    function CheckChild_(Obj, TimeOut, Property1, Value1, Property2, Value2, Property3, Value3)

    {

    var properties, values, child, i=0;



    properties = new Array(Property1, Property2, Property3);

    values = new Array(Value1, Value2, Value3);

    properties = ConvertJScriptArray(properties);

    values = ConvertJScriptArray(values);



    while(!Obj.FindChild(properties, values).Exists)

    {

    Delay(1000);

    Obj.Refresh();

    i++;

    if (i>TimeOut) break;

    }

    Obj.Refresh();

    return Obj.FindChild(properties, values);



    }



    Then you can get the element like this, waiting it for 60 seconds:


    var Obj = CheckChild(ParentObj, 60, "className", "x-panel x-panel-noborder x-border-panel");

    if (!Obj.Exists) return false;

    Obj.Click();

  • naveen_vastare's avatar
    naveen_vastare
    Occasional Contributor

    Thanks for the help


    In the Waitproperty I have used it as string also no outcome from that


    As you suggested I have used the alternative method as below.


    But my question is …if test complete is having built in property to wait for page? Why cant we use those methods? Instead of using the find object method?




    'parentPageObject - Page Object reference

    'PropertyName = Array("className")

    'PropertyValue = Array(" x-panel x-panel-noborder x-border-panel")

    MAX_ITERATION = 20


    Call VerifyPageDownloadForClassObject(PageObject,PropertyName,PropertyValue)


    Function VerifyPageDownloadForClassObject(parent,PropertyName,PropertyValue)


          'For Handing Exceptions

          On Error Resume Next

          VerifyPageDownloadForClassObject = False

          If  parent.Exists = False Then

              Log.Error("Error in VerifyPageDownloadForClassObject: Parent Object does not exists - )

          End If

        

      

                iteration = 1  'Iteration for finding each child

                Set parentObj = parent

                flag = False  ' Set the flag as true before each loop

                Do

                       

                        Set ChildObj = parentObj.FindChild(PropertyName, PropertyValue, 500)



                        If ChildObj.Exists = True Then

                            'Child found - so - Re-set parentObj with the childObject

                             parentObj.wait

                             VerifyPageDownloadForClassObject = True

                        Else

                            iteration = iteration + 1

                            If iteration >= MAX_ITERATION Then

                              Log.Error("Max Iteration hit, while waiting for child:")

                            End If 

                        End If

                    Loop Until flag = True           

                    

         

    End Function


     

  • naveen_vastare's avatar
    naveen_vastare
    Occasional Contributor
    pls let me know to use the Waitproperty method ...If will be helpfull If I get an example
  • Hi,



    You can find information on WaitProperty in the "WaitProperty Method" help topic.