Problems with generated paths for mobile app
Posted: Tue Jun 03, 2014 4:50 pm
Hi there,
This is the first mobile application I have built tests for and before getting to far into it I would like some advice on the best way to go about the mapping of elements. Although successful I think I did more manual configuration of the paths for my web application that I should have needed to.
The the element paths used by the app I am testing change according to whether the device is IOS 6 or IOS 7. I am therefore having to go back and update some of the paths in order to make them function with both IOS versions. This in itself is fine. However...
Most of the paths that are being created by Ranorex list all of the containers and numbers as to whether they are container 1, 2 3 etc. These do not make for very robust paths and also cause me problems when I try and use // to find elements matching specific attributes later.
Here is a specific example. (Snapshot also attached)
/mobileapp[@devicename='iPhone']/container/container[2]/container[2]/container[2]/table[1]/container/container[@localizationkey='NoButton']
I have discovered that one of the differences between the IOS versions is that Ios 6 uses buttons and Ios7 uses containers. This means I need to search for //*[@localizationkey='NoButton']
The containers do not have any caption or type information. However there are details in 'IOS Element' (AccessibilityLable, Localization key) and or 'Mobile UiElement' (Platform Class).
Changing the RanorexPath generation mode - does not really make any difference to the paths.
I have checked the weight rules and set both the Container caption and type to equal 0 if they are blank. Still Ranorex generates the paths the same.
I think to make this work I need to change the paths from absolute to ones that find key elements along the way.
//container[PlatformClass='_UIModalItemRepresentationView']//*[@localizationkey='NoButton']
This will return what I want, be reasonably robust against change and cater for the different types between IOS versions.
I suppose my question is what is the best way for me to achieve this without having to manually edit the path for every element that is not always the same on both versions?
Would you recommend creating a selection of Rooted folders which I guess Ranorex would automatically add valid new elements to, or should I take a different approach?
Any advise is greatly appreciated.
Thanks
Ben
This is the first mobile application I have built tests for and before getting to far into it I would like some advice on the best way to go about the mapping of elements. Although successful I think I did more manual configuration of the paths for my web application that I should have needed to.
The the element paths used by the app I am testing change according to whether the device is IOS 6 or IOS 7. I am therefore having to go back and update some of the paths in order to make them function with both IOS versions. This in itself is fine. However...
Most of the paths that are being created by Ranorex list all of the containers and numbers as to whether they are container 1, 2 3 etc. These do not make for very robust paths and also cause me problems when I try and use // to find elements matching specific attributes later.
Here is a specific example. (Snapshot also attached)
/mobileapp[@devicename='iPhone']/container/container[2]/container[2]/container[2]/table[1]/container/container[@localizationkey='NoButton']
I have discovered that one of the differences between the IOS versions is that Ios 6 uses buttons and Ios7 uses containers. This means I need to search for //*[@localizationkey='NoButton']
The containers do not have any caption or type information. However there are details in 'IOS Element' (AccessibilityLable, Localization key) and or 'Mobile UiElement' (Platform Class).
Changing the RanorexPath generation mode - does not really make any difference to the paths.
I have checked the weight rules and set both the Container caption and type to equal 0 if they are blank. Still Ranorex generates the paths the same.
I think to make this work I need to change the paths from absolute to ones that find key elements along the way.
//container[PlatformClass='_UIModalItemRepresentationView']//*[@localizationkey='NoButton']
This will return what I want, be reasonably robust against change and cater for the different types between IOS versions.
I suppose my question is what is the best way for me to achieve this without having to manually edit the path for every element that is not always the same on both versions?
Would you recommend creating a selection of Rooted folders which I guess Ranorex would automatically add valid new elements to, or should I take a different approach?
Any advise is greatly appreciated.
Thanks
Ben