I am testing a web application by recording test scripts. In doing so I find that the paths that are stored in the Global Repository are unnecessarily detailed.
Example:
I want to test that a certain radio button is checked. In the Global Repository the button is identified by an RxPath that might go something like
"Base: /form[@title~'^MyApp']"
and
"container/container/dom/body/*/div[@id='Main']/*/div[3]/form[@id='MyForm']/*/tr[2]/td[2]/input[@name='something']"
If I now refactor my application to get a nicer layout my test will probably fail, not because the radio button is not checked but because the form tag's parent tag is no longer the third among its siblings. But that is irrelevant to the test! The test target was the status of the radio button, not its exact location in the dom tree.
This is the paths after manual rewriting:
"Base: /form[@title~'^MyApp']container/container/dom"
and
".//self::input[@name='something']"
This must be done manually, but changing a path in the Global Repository is not always easy. E.g. changes will not be accepted if the element is not currently available. So I have to open the relevant web page, possibly going through a long login process, and navigate to the form before I can make changes. With many changes to make this takes time...
What if Ranorex could at least leave out everything in the relative path before the last tag with an id attribute? Like this:
"Base: /form[@title~'^MyApp']container/container/dom"
and
".//self::form[@id='MyForm']/*/tr[2]/td[2]/input[@name='something']"
That would save me a lot of time.
Recorded RxPaths are too exact and too hard to change
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
The good news is that (in the upcoming release)
1) we already addressed a few issues in the repository editor to make editing less painful.
In any case, it should not be necessary that the element is "live" for its path to be edited.
2) web pages ("dom" elements) will also be visible in the root of the element tree. as a result, the web dom is available as a top-level folder in the repository, making grouping easier.
e.g. Application Folder: "/dom[@title='mywebpage']", folders are now created for in-between containers. (for example some div)
However, path generation wont change substantially;
We are planning to make it more tweakable in the future.
If you want to skip certain levels in the dom, just use .//tag in the folder path.
Michael
Ranorex Team
1) we already addressed a few issues in the repository editor to make editing less painful.
In any case, it should not be necessary that the element is "live" for its path to be edited.
2) web pages ("dom" elements) will also be visible in the root of the element tree. as a result, the web dom is available as a top-level folder in the repository, making grouping easier.
e.g. Application Folder: "/dom[@title='mywebpage']", folders are now created for in-between containers. (for example some div)
However, path generation wont change substantially;
We are planning to make it more tweakable in the future.
If you want to skip certain levels in the dom, just use .//tag in the folder path.
Michael
Ranorex Team
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
It was already there, but maybe to hard to findtorlin wrote:The .//tag trick is good. Put it in the User Guide!
http://www.ranorex.com/support/user-gui ... html#c1792
Regards,
Alex
Ranorex Support Team