How to make rooted folder Base dynamic

Ask general questions here.
niteshr_1983
Posts: 2
Joined: Tue Oct 25, 2016 11:04 am

How to make rooted folder Base dynamic

Post by niteshr_1983 » Tue Oct 25, 2016 11:13 am

Hi Guys,

I have automated tests that run on a mobile device as well as on the desktop browser. Now I noticed the rxPath of elements are more or less the same. So, I thought rather than having seperate repositories I can use one repository for both requirements. My base folder for devices is as follows:

/mobileapp[@devicename=$DeviceName]


For desktop it is:

/dom[@domain=$Domain]

I don't want to replicate items in the folders so I tried adding a rooted folder like so:

/?[@domain=$Domain or @devicename=$DeviceName]


However, although it works, this is very slow in finding elements. Is there a better way?

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

Re: How to make rooted folder Base dynamic

Post by Vaughan.Douglas » Tue Oct 25, 2016 12:45 pm

/?[@domain=$Domain or @devicename=$DeviceName]
I think the problem is that you're actually making it an optional node by using the question mark. I think you want to use the asterisk instead.
/*[@domain=$Domain or @devicename=$DeviceName]
I have no idea if this is a good idea, but I think it will help you in your endeavor.
Doug Vaughan

niteshr_1983
Posts: 2
Joined: Tue Oct 25, 2016 11:04 am

Re: How to make rooted folder Base dynamic

Post by niteshr_1983 » Wed Oct 26, 2016 10:27 am

Thanks. Seems to have done the trick :D