Getting the xpath of an element knowing its partial automationid

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
vladrain27
Posts: 1
Joined: Fri May 24, 2019 11:59 am

Getting the xpath of an element knowing its partial automationid

Post by vladrain27 » Tue Dec 03, 2019 12:27 pm

So maybe the title doesn't express my need but i will describe it here.
I use ranorex api in a visual studio project.
Now i have a element which is a hardcoded string except a number: text[@automationdid='Phone1'], number 1 is a number that can change.
Can I search in a element for a partial path like text[@automationid='PhoneX'] without giving the x?

gridle
Posts: 16
Joined: Mon Mar 10, 2014 5:13 pm

Re: Getting the xpath of an element knowing its partial automationid

Post by gridle » Thu Dec 05, 2019 1:18 pm

Hi,

sure, it is possible.

Ranorex Path can be used as regular expression.
In you case you can use next rxPath:

text[@automationid~’Phone[0-9]’] -> test will look for Text element with automationid Phone0, Phone1,...,Phone9
or you can use this:
text[@automationid~’Phone’] -> test will look for Text element with automationid which contains "Phone".

All info for rxPath you can check by link below:
https://www.ranorex.com/help/latest/ran ... th-syntax/
https://www.ranorex.com/help/latest/ran ... ex-syntax/