Page 1 of 1

Add Variable in Base xPath?

Posted: Thu May 28, 2020 6:44 am
by ThomasMateo
Based on the input (Missouri, Iowa, California) i have to modify the Base xPath in Ranorex repository.
If Missouri, it should be test.mo.google.com
if Iowa, it should be test.ia.google.com
if California it should be test.ca.google.com

/dom[@domain~'test+$domainURL+.google.com']

I have created a variable called domainURL and thru data binding passed a value for domainURL but it is not working.

Re: Add Variable in Base xPath?

Posted: Thu May 28, 2020 7:31 am
by odklizec
Hi,

The xpath with variable must look like this:
/dom[@domain='test.'+$domainURL+'.google.com']
I personally don't like the idea to have variables in DOM, because it means I have to bind every single recording using repo elements ;) So in situation like yours, I prefer to 'hardcode' the variable strings, like this:
/dom[@domain~'test.(mo|ia|ca).google.com']

Re: Add Variable in Base xPath?

Posted: Wed Mar 17, 2021 7:33 am
by DrPsyche
ThomasMateo wrote:

if California, it should be test.ca.google.com
if Iowa, it should be test.ia.google.com
If Missouri, it should be test.mo.google.com
Could you please help me understand how I can pass values to repository variables to write my essay fast test.

_
If you made the same mistake like I did with the default value, here's a helpful link:
Define test and variables >>

https://www.ranorex.com/help/latest/ran ... n-testing/

Re: Add Variable in Base xPath?

Posted: Wed Mar 30, 2022 2:48 pm
by zeno22
How would you combine these two xpaths to find this OR that xpath? So, the ideal xpath would search for these two items, and if one is found, it would proceed.

Re: Add Variable in Base xPath?

Posted: Thu Mar 31, 2022 10:10 am
by odklizec
Hi,

There is no option to add OR for two different xpaths. Logical operators could be used only for attributes. Please post an example of xpath(s) you are working with. Thanks.