Page 1 of 1

Using wildcards possible?

Posted: Thu Sep 08, 2016 8:40 am
by roxter
Hi!
I have a question regarding the use of "wildcards" or regular expressions.
My problem is I have to perform a click action on this element:
.//div[#'logo']/span[2]/?/?/a[@innertext='Techa 2.0.0-rc.1']

Well as the application version changes the name of the element will change to Techa 2.0.0-rc.2 and so on....
How can I solve this problem like this with wildcards Techa 2.0.0-rc.* ?

Re: Using wildcards possible?

Posted: Thu Sep 08, 2016 8:50 am
by odklizec
Hi,

Yes, it is possible to use regular expressions in xpath. You just need to use '~' instead of '=' in xpath expression. I would suggest you to start with Ranorex xpath basics, described here:
http://www.ranorex.com/support/user-gui ... xpath.html

Re: Using wildcards possible?

Posted: Thu Sep 08, 2016 9:06 am
by roxter
Hi!
Thank you for your answer. Could you help me with the shown example. How would it have to look like if I would like to check only for "Techa".

Best wishes

Re: Using wildcards possible?

Posted: Thu Sep 08, 2016 9:10 am
by roxter
I got it, it is quite simple I used ^Tech :-)
Thank you very much!

Re: Using wildcards possible?

Posted: Thu Sep 08, 2016 9:12 am
by odklizec
Hi,
Try this xpath (matches all elements with innertext starting with 'Techa'):
.//div[#'logo']/span[2]/?/?/a[@innertext~'^Techa']