Application Xpath changing frequently

Ask general questions here.
alpesh.dhakad
Posts: 15
Joined: Wed Oct 31, 2018 2:10 pm

Application Xpath changing frequently

Post by alpesh.dhakad » Mon Aug 12, 2019 7:52 am

Hi,

We are doing automation on desktop application (Built using Dev-Express controls plugin).
As we are following Agile (Sprint) methodology where we are getting new build in each sprint. In the product increment cycle, we are facing issue about xpath changes which seems to be not controlled by developers. As, Dev-Express people use to upgrade their version where lot of changes happens.
We had a discussion with developers on this issue and they told that they are not doing anything on changing this containers or tree items or indicators. It might be issue with devexpress controls. So, could you please suggest a approach which we should take to automate our application so that with every product increment we'll not face issue with object identification.

Refer attached snapshots.

For e.g.
1) Earlier there was container with caption now got changed to container with number.
Old Xpath - /progressbar/picture[8]/indicator[@automationid='PART_LoadingPanel']/table/container[7]/container[@caption='']
New Xpath - /progressbar/picture[8]/indicator[@automationid='PART_LoadingPanel']/table/container[7]/container[2]

2) Earlier there was tree items which now get changed to Indicators which even changes on collapse and expand.
Old Xpath -progressbar/?/tree/treeitem[2]/container[@automationid='ItemsHost']/treeitem[2]/container[@automationid='ItemsHost']/treeitem[1]
New Xpath - progressbar/picture[6]/tree/container[8]//text[@caption~'^Built-in\ Loop-A']

Old Xpath - treeitem[2]/container[@automationid='ItemsHost']/treeitem[2]/container[@automationid='ItemsHost']/treeitem[2]
New Xpath - progressbar/picture[6]/tree/container[8]//text[@caption~'^Built-in\ Loop-B']

Old Xpath - progressbar/picture?[6]/?/?/treeitem[2]
New Xpath - progressbar/picture[6]/tree/container[8]//text[@caption~'Node']

3) Earlier there was no container and now there is container which is one of the issue to find objects.
Old Xpath - progressbar/picture[8]/indicator[@automationid='PART_LoadingPanel']/table/container[7]/container[@caption='']/container[$sRow]//text[1]
New Xpath - progressbar/picture[8]/indicator[@automationid='PART_LoadingPanel']/table/container[8]/container[2]/container[$sRow]//text

4) Earlier there was no list but in new build there is list
Old Xpath - /form[@automationid='me']/?/?/container[@automationid='PART_AutoHideControl']/?/?/list[2]/container[@automationid='PART_ItemsPresenter']/button[@text='Multiple Point Wizard']
New Xpath - /form[@automationid='me']/?/?/container[@automationid='PART_AutoHideControl']/list/list[1]/list[2]/container[@automationid='PART_ItemsPresenter']/button[@text='Multiple Point Wizard']

I have attached snapshots for navigation tree item where indicators are getting changed on expand and collapse. How we could able to identify this objects ? Please suggest.
Refer attached snapshots.

Let me know if any other information required.

Thanks
Attachments
Navigation tree.rxsnp
Navigation Tree Container
(2 MiB) Downloaded 1 time
Navigation tree full.rxsnp
Navigation Tree Full items expanded
(3.33 MiB) Downloaded 1 time
MainProcessor Collapsed Navigation tree.rxsnp
Navigation Tree MainProcessor Collapsed
(3.32 MiB) Downloaded 2 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5071
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Application Xpath changing frequently

Post by odklizec » Mon Aug 12, 2019 8:20 am

Hi,

Generally speaking, in case of frequently changing xpaths, you must simply remove all potentially changing elements from the xpaths recorded by Ranorex. You should also eliminate as much as possible (ideally all) indexes, because they are definitely volatile. Neither of the xpaths you provided returns any element in the snapshots you posted. So I can only suggest some general hints.

The xpaths you are looking for, should look like this:

Code: Select all

progressbar/picture/indicator[@automationid='PART_LoadingPanel']/table//container[$sRow]//text

Code: Select all

//form[@automationid='me']//container[@automationid='PART_AutoHideControl']//container[@automationid='PART_ItemsPresenter']/button[@text='Multiple Point Wizard']
In case the xpaths without indexes return more elements, you must apply the approach I suggested in your another post. Basically, you must find some parents/child elements (as anchors), from which you must traverse to the element you want to use. In other words, recording elements is just the first step. You must review and edit all recorded repo elements to make their xpaths stable.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

alpesh.dhakad
Posts: 15
Joined: Wed Oct 31, 2018 2:10 pm

Re: Application Xpath changing frequently

Post by alpesh.dhakad » Wed Aug 14, 2019 8:21 am

Hi,
Thanks. I will try to create xpaths as per your suggestion.