I am working with Ranorex tools. An application in which I am working is based on .NET and for capturing objects we take XPATH of a particular object and we are using that XPATH to check that object is present or not. But after some time if property of objects change then we need to change XPATH again. Is there any solution for that?
Ranorex XPATH Issue
2.8k Views Asked by user4376935 At
2
It sounds like your XPath is dependent on the property that is changing to find the object. The thing about XPaths is they are able to track on any property. So for instance if you are tracking on an object on a class then the class changes that object will no longer appear to be there to the xpath.
To fix this just find a different property of your object to track on. For instance you could track on value, or position, or nearly any other htmnl property, just try to make it one that will not change.
The best advice i can give you on looking for an xpath is to make it as short as possible. for instance if you are looking for an objects unique id then your path needs one element. If you are looking for a specific button on a specific line of a dynamically populated table that has nothing special about it what you could do is find the row on the table given the text of a specific table cell then find the button in the proper cell of the found table row. Don't get caught up in thinking the spy tool will always give you the only xpath there is almost always another way to find the object it just may not be the most direct.
Here is the ranorex xpath help page for all the regular expressions and other options to edit your xpaths.