RanoreXPath versus XPath

Ranorex is a proprietary alternative to Selenium. To select an element, they’re using the so-called RanoreXPath. Both, RanoreXPath and XPath, are pretty similar in their syntax, but are different in following areas:

 

 

Feature RanoreXPath (Ranorex) Xpath (Selenium) Description
Text contains a certain pattern /dom[@domain='federations.gfk.com']//*[@id~'email'] .//*[contains(@id,'email')] RanorexPath uses ~ to start a Regex, which is a substitute for Xpath's contains()-function:
http://www.ranorex.com/support/user-guide-20/ranorexpath.html#c3294
Tab-Location Prefix /dom[@page='FlexExample.html'] to recognize the browsertab.
No prefix, as the browser-tab is selected by code:

driver.get(http://www.google.de);
Ranorex doesn't need the prefix, but it's strongly recommanded to use it for two reasons:
1. Without the prefix, Ranorex climbs down each and every window to search for an element, which matches the RanoreXPath - and that may be very time-consuming!
2. Think of two opened browsers with elements recognized by the same RanoreXPath - those situations cause non-deterministic behaviour, which is hard to debug.
Driver of the language-power Regex Functions To cope with the special-cases of recognizing UI-elements, you need a powerful language.
Make the paths case-insensitive i: Translate() Case-insensitivity in Xpath: http://stackoverflow.com/a/586260/1777526
Selecting the x-th element, that match the path /dom[@domain~'mydomain']//div[@class='header'][2] (.//div[@class='header'])[2]
Locate svg-elements /dom[@domain~'mydomain']//tag[@TagName='rect'][13] (//*[local-name()='rect'])[13]
quotes only single quotes allowed single and double quotes allowed
Multiple Element matches Decides with a certain algorithm, which element will be selected If more than one element match the XPath, the first in the DOM is selected
Return of text The inner text of a certain element is returned The concatenated text of all descendant elements is returned