How to use RawText GDI plugin through Visual Studio

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

How to use RawText GDI plugin through Visual Studio

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

Hi,
I am using Ranorex 3.0. I have an application which contains MFC grid. The Ranorex spy x86 can very well recognize the raw text within it. But when i take the same rxpath and use it in visual studio, the element cannot be found. I am giving the code in the visual studio solution.

Element elem1=null;
Element elem2=null;
var plugins=Ranoerx.Core.PluginManager.Instance;
plugins.LoadDefaultPlugins();
RawTextFlavor.Instance.ClassNames.Add(new Regex("GXWND"));
string path1=@"/form/tabpagelist/container/container/element";
string path2=@"/form/tabpagelist/container/container/element/rawtext[@rawtext='Cost]";
Host.Local.TryFindSingle(path1,25000,out elem1);
Host.Local.TryFindSingle(path2,25000,out elem2);
//elem1 is an Element, but elem2 is null always even though when i paste the path2 in ranorex spy and press enter, it identifies.
Do i need to do any changes on configuration for Visual Studio? Kindly Help.

(As the application under test is under a secured area i cant provide the snapshot of it)
Regards,
Siva R S

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

Re: How to use RawText GDI plugin through Visual Studio

Post by Support Team » Fri May 13, 2011 8:52 am

Hi,

Normally there shouldn't be a problem with the Raw Text Plug-In in Visual Studio. Have you added the reference to the references in Visual Studio? Please notice that the Raw Text Plug-In is only for x86, because the x64 is currently not supported.

Regards,
Peter
Ranorex Team

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: How to use RawText GDI plugin through Visual Studio

Post by sdaly » Fri May 13, 2011 10:57 am

Try changing Element to Ranorex.RawText

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

Re: How to use RawText GDI plugin through Visual Studio

Post by vengaishiva » Tue May 17, 2011 6:20 am

Hi,
Can you explain a bit detail. In the rx path mentioned by me in the code, it can identify up to the element, but not any raw text within it (only in visual studio)
Regards,
Siva R S

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

Re: How to use RawText GDI plugin through Visual Studio

Post by Support Team » Wed May 18, 2011 8:22 am

Hi,
could it be that you have forgotten a tick in the code below (@rawtext='Cost] instead of @rawtext='Cost'])?
vengaishiva wrote:string path2=@"/form/tabpagelist/container/container/element/rawtext[@rawtext='Cost]";
If not can you prepare us a snapshot from your AUT? Then it would be much easier for us to help (http://www.ranorex.com/support/user-gui ... files.html).

Regards,
Markus
Ranorex Team

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

Re: How to use RawText GDI plugin through Visual Studio

Post by vengaishiva » Thu May 19, 2011 7:02 am

hi,
That was a typo error. The application is in a secured location. I cant take it out. Are you able to reproduce the same issue (i.e in visula studio)?
Thanks,
Siva R S

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

Re: How to use RawText GDI plugin through Visual Studio

Post by Support Team » Thu May 19, 2011 3:25 pm

Hi,

No we have no issues with RawText Plug-In in Visual Studio. A few of our customers use the RawText Plug-In with Visual Studio and they didn't report such an issue.

Regards,
Peter
Ranorex Team

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

Re: How to use RawText GDI plugin through Visual Studio

Post by vengaishiva » Fri Jun 03, 2011 1:17 pm

hi,
I have attached a rar file with this mail. In that please run the gridcontroldemo.exe which is the MFC Grid application. I am trying to identify the raw text in the grid using Visual Studio (ConsoleApplication1 is the solution file).But it is not getting identified. (A snapshot is also provided which shows that spy can identify the rawtext. I am using Ranorex 3.0). Kindly help regarding this.

Siva R S
You do not have the required permissions to view the files attached to this post.

User avatar
sdaly
Posts: 238
Joined: Mon May 10, 2010 11:04 am
Location: Dundee, Scotland

Re: How to use RawText GDI plugin through Visual Studio

Post by sdaly » Fri Jun 03, 2011 1:59 pm

Have you actually referenced the rawtext dll?

Put this in your code as a test -
Ranorex.RawText rt = @"/form/tabpagelist/container/container/element/rawtext[@rawtext='Cost]";

Compile it and see if you get an error, if so then reference the rawtext dll!!

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

Re: How to use RawText GDI plugin through Visual Studio

Post by vengaishiva » Fri Jun 03, 2011 2:08 pm

hi,
I have referred the Ranorex.Plugin.RawText dll already. But not getting the expected result.
Thanks,
Siva R S

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

Re: How to use RawText GDI plugin through Visual Studio

Post by Support Team » Fri Jun 03, 2011 9:21 pm

Hello,

There is a list that contains the processes that should be handled by the rawtext plugin.
In the Spy right-click on the entry in the tree view that corresponds to your application and press
"Add Process To GDI Capture List".

Regards,
Roland
Ranorex Support Team

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

Re: How to use RawText GDI plugin through Visual Studio

Post by vengaishiva » Mon Jun 06, 2011 6:34 am

Hi,
I have tested the appication with spy and able to get the raw text. I have also did the right click and added it to GDI capture list. My question is why it is not accessing via visual studio?

Thanks,
Siva R S

prabhu_thi
Posts: 8
Joined: Wed Feb 02, 2011 4:28 am

Re: How to use RawText GDI plugin through Visual Studio

Post by prabhu_thi » Mon Jun 06, 2011 6:57 am

HI,

I tried with the same,its not working for me too.SPY is able to access the RawText with the available path,but thru the .net code not able to recognise the same.

bool bValid = Host.Local.TryFindSingle("/form[@title='MFC Grid Control Demo']/element/rawtext[@rawtext='75' and @row='3']", out elem);

This is the code,but its not recognising the control.But it able to recognise the till the element before that.

As u mentioned in previous post, i tried with

Ranorex.RawText rt = @"/form[@title='MFC Grid Control Demo']/element/rawtext[@rawtext='75' and @row='3']"

But the same is also failing..

Can u run the code and check the same...

Snapshots are also available in the rar that provided by SIVA earlier....Have u checked the same..?

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

Re: How to use RawText GDI plugin through Visual Studio

Post by Support Team » Mon Jun 06, 2011 9:36 am

Hello,

I've tried it with VS 2010 and it worked.
Two things need to be considered:
  • as mentioned above: the process must be in the GDI capture list
  • yous VS application must be targeting 32 bit (x86).
    Check in the Build tab of your VS project properties.
Regards,
Roland
Ranorex Support Team

prabhu_thi
Posts: 8
Joined: Wed Feb 02, 2011 4:28 am

Re: How to use RawText GDI plugin through Visual Studio

Post by prabhu_thi » Mon Jun 06, 2011 9:43 am

I found the issue resolved after making the window visible.It mean that , if UI is entirely visible,its able to detect.If some other over rides the same.Its not able to do so...

But for other normal controls..its not the case..

Is it expected behaviour..?