Forum Discussion

mmadaan's avatar
mmadaan
Occasional Contributor
13 years ago

Elemenation of DOM approach

Hi,



This is Mohit from Financial Engines and we are using test complete from last 2 years but we ran into 1 major problem while using it.



The problem is:



For verifying the UI elements we are using the DOM approach example:



If (w1.Panel("page").Panel("page_body").Panel("page_body_content").Panel("pnlGoals_panel").Panel(1).Panel(0).innerHTML <> "Goals") Then

    TCstatus = "FAIL"

    Else

    TCstatus = "PASS"

End If

testCaseId = "UI 1.3.3 - Goals is Displayed"

Call Commons.doLogTestCaseStatus(testCaseId, TCstatus)



But if some panel changes in between, our automation is going to fail and it takes lot of effort to rectify that.



We are already using the NATIVEWEBOBJECT function for functional automation but it will not solve the problem for UI automation as we need to verify the positions and path as well for UI verification.



We explored a bit and came up with a new approach to handle this. Example:



arrObjProperty = Array("ObjectType","FullName")

arrObjPropValue = Array("Panel","*Panel(""pnlOtherIncome_panel"").Panel(1).Panel(0)")

Set objectRef = pnlBasePanel.FindChild(arrObjProperty,arrObjPropValue,20000,True)

Ref_DOMChangeLibrary.fnVerifyProperty "UI 2.5 - Goals is Displayed",objectRef.innerHTML,cmpEqual,"Other retirement income",False


where pnlBasePanel is Aliases.IE.Page(“*”).Page(“page”).Page(“page_body”).Page(“page_body_content”)




Now there are few queries regarding this:



Query1:

-----------------

Is there any other best approach to avoid DOM and use some other approach that validates the UI test cases (Example of the UI test case: Logo should be present in upper left corner of the web page)



Query2:

------------------

As per the new approach shown above:

Can we define the Base panel at global level or across the project through property files or project varibales so that we need to add the base panels in each and every script.



Thanks and Regards

Mohit

mmadaan@financialengines.com

3 Replies

  • amit_deshpande's avatar
    amit_deshpande
    Occasional Contributor
    Hi Madan,



    In this case the tree hierarchy of objects can be used.



    It is always a better way to find the objects with Find method rather than giving the entire path to it, which eliminates the possibility of failures even if some objects are modified.



    Example for this can be-



    reqObj=<basepanel>.Find(propertyname,propertyvalues,depth)



    Thanks,



    Amit Deshpande
  • mmadaan's avatar
    mmadaan
    Occasional Contributor
    Hi Amit,



    Thanks for the quick response.



    Query1:



    How can we use the tree hiearchy of the objects. It would be great be if you can explain it with the example



    Query2:

    If we do not have the value of any property like (id, name), then what is the alternate way of using the base panels.



    reqObj=<basepanel>.Find(propertyname,propertyvalues,depth)



    Please let me know your thoughts.



    Regards

    Mohit
  • amit_deshpande's avatar
    amit_deshpande
    Occasional Contributor
    Hi Mohit,



    1.The tree hierarchy of the objects can be set from the project options.



    Project Properties > Open Applications >Web Testing ( select tree model as Tree )



    The way to use the tree object effectively is to get the reference of the parent object of the required object and get child object using Find method. The depth to which child object is to be identified can be specified in Find method.



    2.If the id,name are not available or not consistent, you can use the classname or objectType for object recognition. Also the combination of multiple properties can be used to find the objects.



    Regards,



    Amit