Special character to override inherited Xpath

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
jackrabbit
Posts: 47
Joined: Wed Mar 18, 2015 10:06 pm

Special character to override inherited Xpath

Post by jackrabbit » Wed Mar 18, 2015 10:20 pm

I need to build a large menu system in my Repository. To keep the Xpath to a minimum, I mimic the actual menu structure with Rooted folders, this also allows me to quickly find any menu option by browsing the Rooted folder, exactly like the actual menu system.

The problem I have is that I also need to create a FORM element for each option, so I can make sure the recording actually opened the right form. The Xpath to check my form is "/form[@title~'^Whatever title" but I would like to keep it as part of the same Repository structure to keep things well structured and together.

Right now I need to figure out how many "../" I need to add to my form Xpath to "backtrack" up to the root level, and then go look for the form. Is there a way to replace all those "../../../../../" by a special character that says "go back to the root node"?

I joined a PrintScreen of the Recording and the Repository that launches a menu option and validates that the right form is displayed at the end.

P.S. If such a "ROOT" code down not exists, it would be a nice feature to add in a subsequent release ...

Thanks
Attachments
2015-03-18_17h09_16.png
2015-03-18_17h09_16.png (59.03 KiB) Viewed 694 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Special character to override inherited Xpath

Post by Support Team » Fri Mar 20, 2015 5:38 pm

Hello jackrabbit,

Thank you for the detailed description, but I am afraid that this is not really recommended because your test run will get slower if you do this. Ranorex has to search first for the context menu and after that for the new form element.
I am not even sure if this works in general because usually the context menu closes after clicking and Ranorex can no longer find it, but maybe it depends on your application.
I my opinion it would be better to create a new rooted folder for the form which was opened form the context menu.


Regards,
Bernhard
.
Image

jackrabbit
Posts: 47
Joined: Wed Mar 18, 2015 10:06 pm

Re: Special character to override inherited Xpath

Post by jackrabbit » Fri Mar 20, 2015 6:25 pm

OK, thanks