Automatically generate xpath, for container item with a textincenter, in a dynamic application

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
kuzma.molchanov
Posts: 1
Joined: Wed Oct 21, 2020 7:16 am

Automatically generate xpath, for container item with a textincenter, in a dynamic application

Post by kuzma.molchanov » Wed Mar 31, 2021 7:41 am

Our application uses dynamic generation of interface elements.
Container items do not have unique names.
But they contain a text element.
How to set up xpath generation so that text is automatically added to container elements in the xpath.

Example:
now when you click on the container element, the xpath looks like this
Screenshot_152.png
Screenshot_152.png (75.91 KiB) Viewed 62 times
I would like it to be formed like this
Screenshot_151.png
Screenshot_151.png (69.14 KiB) Viewed 62 times

doke
Posts: 15
Joined: Fri Mar 29, 2019 2:33 pm

Re: Automatically generate xpath, for container item with a textincenter, in a dynamic application

Post by doke » Fri Apr 02, 2021 5:10 pm

try skipping useless items from the xpath,
modify manually to :
.//container[@your stuff here ]
modifying the settings in ranorex might also work:
got settings| tab advanced
modify speed vs robustness setting and record again with different setting, your xpath might get shorter /langer on differnt setting
You might also add your own weight rules which makes ranorex add your prefered attribute to the xpath automatically.
:!: But take extreme care when changing /adding weights, you might corrupt the recognition in such way nothing will be found :!: