Change the Xpath automatically after a weight rule

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
AgileTesterCarlo
Posts: 7
Joined: Mon May 08, 2017 2:49 pm

Change the Xpath automatically after a weight rule

Post by AgileTesterCarlo » Thu May 18, 2017 6:08 am

Hi,

We are running a POC on an Outsystems application. Outsystem generates a webpage and it generates new id's for the same element like this: test_<changingID>_Username
The last part of the element stays the same so we created a weight rule to have Ranorex identify the element.
This works fine.
The next thing we like to do is that it removes everything in the xpath before the '_Username'. This is now done by hand for each repository item, but as this applies to 99% of the repo-items, it would be nice if we could do this automatically when the item is added to the repository or a bulk update on the repo-items.
Is this possible?

Kind Regards, Carlo

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

Re: Change the Xpath automatically after a weight rule

Post by odklizec » Thu May 18, 2017 9:55 am

Hi Carlo,

I'm afraid, the only way how to achieve what you want is to edit the rxrep file in a good text editor (e.g. notepad++) and simply remove/replace the parts of xpaths you no longer need.
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

Vaughan.Douglas
Posts: 254
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: Change the Xpath automatically after a weight rule

Post by Vaughan.Douglas » Thu May 18, 2017 6:40 pm

You might be able to get this done by nesting your objects into rooted folders, but I'm guessing you want this done without manual intervention.

You could probably build a script that reads in the rxrep file and edit the XML as odklizec mentions. Is this purely for cosmetics or is the RxPath not valid?
Doug Vaughan

AgileTesterCarlo
Posts: 7
Joined: Mon May 08, 2017 2:49 pm

Re: Change the Xpath automatically after a weight rule

Post by AgileTesterCarlo » Fri May 19, 2017 8:06 am

Thanks, changing the rxrep file outside of ranorex is an option we did not think of yet.
The xpath changes are necessarry at least each build as outsystems changes the first part of the ID on every build. We can build some automated script for that.