Invalid RxPath Exception

Ask general questions here.
User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Invalid RxPath Exception

Post by Ciege » Thu Jun 04, 2009 12:21 am

Hi guys...

I am receiving an invalid RxPath exception when I am trying to find a Ranorex.TreeItem using an RXPath I extracted from the TreeItem using GetPath.

I have a Tree that I read all the data from and store it in an array that I can access later.

The code used to get the RxPath is:

Code: Select all

string strXPath = Item.Element.GetPath(Ranorex.Core.PathBuildMode.Reduce).ToString();
Which Returns:

Code: Select all

/form[@controlname='frmMainDialog']/element/*/container[@controlname='panel1']/element/tree/container[@accessiblename='Data Panel']/treeitem[@accessiblename='Node4']
Later in my code I need to double click on certain TreeItems. I use this code to refind the TreeItem and click on it.

Code: Select all

HDTreeItem = HDClientForm.FindSingle(strXPath, 5000);
HDTreeItem.DoubleClick();
However, at the FindSingle line I receive the Invalid RxPath Exception:

Code: Select all

Ranorex.RxPathException: Invalid RxPath '/form[@controlname='frmMainDialog']/element/*/container[@controlname='panel1']/element/tree/container[@accessiblename='Data Panel']/treeitem[@accessiblename='Node4']|'. ---> Ranorex.RxPathException: Invalid character at character position 165. at Ranorex.Core.RxPath.TryInit(String path) --- End of inner exception stack trace --- at Ranorex.Core.RxPath..ctor(String path) at Ranorex.Core.RxPath.op_Implicit(String path) at H_MathRegression_English.Program.Test1(Form HDClientForm, String[] strArrayPBSStartingValues) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\H$MathRegression_English\H$MathRegression_English\Program.cs:line 630 

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Post by Ciege » Thu Jun 04, 2009 12:37 am

Please disregard. Somehow my RxPath string had an unprintable character at the end of it. After I removed that all was good.