Page 1 of 1

Regularize XPath

Posted: Mon Mar 26, 2012 11:59 pm
by SurajJaldu
Hi,

When I add an object to repository I can the XPath as below.

Code: Select all

body/form/div[@id='content']/div[@id='LoginPanel']/span/div[1]/input[@id='Login1_nameTextBox']
I could edit the XPath using Path Editor by removing few parent elements in the hierarchy. Now, I can see the XPath as below.

Code: Select all

*/*/*/*/*/*/input[@id='Login1_nameTextBox']
My question, is there a way to make the path more simple. Probably like '*/input[@id='Login1_nameTextBox']'. Just trying to eliminate the dependency on the hierarchy.

Thanks,
Suraj

Re: Regularize XPath

Posted: Tue Mar 27, 2012 1:31 pm
by Support Team
Hi,
SurajJaldu wrote:My question, is there a way to make the path more simple. Probably like '*/input[@id='Login1_nameTextBox']'. Just trying to eliminate the dependency on the hierarchy.
Please take a look to following blog for more information about the RxPath
http://www.ranorex.com/blog/ranorexpath-tips-and-tricks

Regards,
Peter
Ranorex Team

Re: Regularize XPath

Posted: Wed Mar 28, 2012 12:27 am
by SurajJaldu
That was easy and helpful. Thanks Peter :)