Not able to identify TabPage using regular expression

Ranorex Studio, Spy, Recorder, and Driver.
kiran.pol
Posts: 12
Joined: Tue Oct 06, 2009 7:40 am

Not able to identify TabPage using regular expression

Post by kiran.pol » Tue Oct 13, 2009 1:07 pm

I have a tab page something like Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename='Edit Customer [10378456]']";.

The value in the brackets keep changing.Next time it might be something like - Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename='Edit Customer [1045237894]']";

So i am trying to identify the tab page using regular expression something like

Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename='Edit Customer .*']";
but i am getting elementnotfound exception.

Why the regular expression is failing to identify the tab page.

devenb
Posts: 24
Joined: Mon Mar 09, 2009 11:50 am
Location: Bracknell, UK

Re: Not able to identify TabPage using regular expression

Post by devenb » Tue Oct 13, 2009 1:40 pm

kiran.pol wrote:I have a tab page something like Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename='Edit Customer [10378456]']";.

The value in the brackets keep changing.Next time it might be something like - Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename='Edit Customer [1045237894]']";

So i am trying to identify the tab page using regular expression something like

Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename='Edit Customer .*']";
but i am getting elementnotfound exception.

Why the regular expression is failing to identify the tab page.
Hi Kiran,

Since the accessiblename attribute of the Tab changes in your case, I would suggest you to amend your path to:

Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename~'^Edit\ Customer']";

and check whether the tab can be accessed for different values.

Regards,
Deven B.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Not able to identify TabPage using regular expression

Post by Support Team » Tue Oct 13, 2009 2:58 pm

kiran.pol wrote:Ranorex.TabPage TB_Edit_Customer = "/form[@controlname='MainForm']/container[@controlname='panelTabControlHolder']/*/*/tabpage[@accessiblename~'Edit Customer .*']";
You forgot to use the '~' operator instead of '=' in the RxPath attribute comparison. The text will only be interpreted as a regular expression if you use the ~ comparison operator.

Regards,
Alex
Ranorex Support Team

kiran.pol
Posts: 12
Joined: Tue Oct 06, 2009 7:40 am

Re: Not able to identify TabPage using regular expression

Post by kiran.pol » Wed Oct 14, 2009 7:42 am

Thanks a lot. I definitely missed to use "~"

Now it is working fine for me :)