Problem with Host.Local.TryFindSingle

Ask general questions here.
vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Problem with Host.Local.TryFindSingle

Post by vengaishiva » Tue May 03, 2011 3:39 pm

Hi,
I am using Ranorex 3.0. Whenever i try to get an element using the following code, the element is always null. But when i took the same rxpath and put it in spy, it is identifying that control. What can be the problem?
//My Code
Element elem=null;
string [email protected]"/form[@controlname='MainForm']/element[@controlname='xtraTabControl1']/container[@controlname='xtraTabTrades']/container/container/container[@controlname='panel1']/container/element/table[@accessiblename='Error message']";
Host.Local.TryFindSingle(path,30000,out elem);

//I tried giving the same path in ranorex spy( both x 86 and x 64) Both can identify that. Only the Host.Local.TryFindSingle is not working.
Any help on this? :(
Regards,
Siva R S

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

Re: Problem with Host.Local.TryFindSingle

Post by Support Team » Tue May 03, 2011 3:57 pm

Hi,

Please take a look to following link and read the found element parameter
http://www.ranorex.com/Documentation/Ra ... ngle_1.htm

Are you developing in Ranorex Studio or in Visual Studio? If you use Visual studio, please check if you main methods has the property [STAThread]

Regards,
Peter
Ranorex Team
.
Image

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Problem with Host.Local.TryFindSingle

Post by vengaishiva » Tue May 03, 2011 4:00 pm

Hi,
Thanks for the immediate reply :-) . I am using ranorex in visual studio. The main method has [STAThread] property. In the same application Host.Local.TryFindSingle method it is able to identify some other buttons. But not this table and any items within table, even though spy can identify that.
Regards,
Siva R S

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

Re: Problem with Host.Local.TryFindSingle

Post by Support Team » Tue May 03, 2011 6:38 pm

Hello,

could you write some lines of code that use the TryFindSingle() with parts of your path to find out where it is stuck. If you cannot find the solution in this way, please send us the RanoreXPath and a snapshot of your application to [email protected] with some explanation or a link to this forum post.

Regards,
Roland
Ranorex Support Team
.
Image

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Problem with Host.Local.TryFindSingle

Post by vengaishiva » Wed May 04, 2011 6:55 am

Hi,
I only have 3 lines in the code.
string [email protected]"/form[@controlname='MainForm']/element[@controlname='xtraTabControl1']/container[@controlname='xtraTabTrades']/container/container";
Element ele=null;
Host.Local.TryFindSingle(path,30000,out ele);

When using the visual studio, i can get the element till the last but one container(i.e the container in bold) in the rxpath mentioned above.When i add the next container(underlined) in the rxpath i cant get the element. But i use the same code in ranorex studio, it can identify the entire rxpath(both the containers) and gives me the element.
Kindly help.

Regards,
Siva R S

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Problem with Host.Local.TryFindSingle

Post by vengaishiva » Wed May 04, 2011 8:04 am

Hi,
I have used the same path with ranorex 2.3 . Its working well and good. Only in 3.0 (using visual studio) am unable to get.
Thanks,
Siva R S

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

Re: Problem with Host.Local.TryFindSingle

Post by Support Team » Wed May 04, 2011 11:32 am

Hi,

can you please provide us a snapshot of your application under test.
Basically there differences within object recognition in Ranorex 3.x to the object recognition within Ranorex 2.3.x.
Following link will show you how to generate a snapshot file:
http://www.ranorex.com/support/user-gui ... files.html
You can either send your snapshot file to our support mail box support_at_ranorex.com or attach it directly to your next forum post.

Regards,
Tobias
Support Team
.
Image

vengaishiva
Posts: 62
Joined: Wed Mar 09, 2011 4:40 pm

Re: Problem with Host.Local.TryFindSingle

Post by vengaishiva » Thu May 12, 2011 10:22 am

Hi,
An update on the problem above. I made the rxpath working by changing the problematic container into elements. This is working in visual studio. But not in Ranorex Spy.

[email protected]"/form[@controlname='MainForm']/element[@controlname='xtraTabControl1']/container[@controlname='xtraTabTrades']/container/container";
Changed the last container into element and it is working fine (only in visual studio)

Thanks,
Siva R S