Controls has dynamic elements which are getting repainted

Ask general questions here.
harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Controls has dynamic elements which are getting repainted

Post by harendra » Fri Dec 28, 2012 12:11 pm

Hi,

i am working on an automation piece right now using Ranorex 3.3.0. wherein I have a control which has elements.

everytime when I close the form and re-open it, the control is static however the elements int he control get repainted depending upon the layout you choose.

When I use the spy to check on the elements in the control, every time I get a new element number, Is there a way to identify these elements. When I look at the properties of the element, the control ID itself is changing.

Please help.

regards
Harendra

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

Re: Controls has dynamic elements which are getting repainted

Post by Support Team » Fri Dec 28, 2012 1:29 pm

Hi,

Is there another attribute which uniquely identifies the elements?
In order to analyze the issue in detail we would need a Ranorex snapshot file, could you post or send ([email protected]) us two snapshots of your application (of different layouts)?
Following link will show you how to generate a snapshot file:
Creating Ranorex Snapshot Files.

Regards,
Markus
.
Image

harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Re: Controls has dynamic elements which are getting repainted

Post by harendra » Fri Dec 28, 2012 3:51 pm

Hi Markus,

I have sent you the snapshot. Please let me know in case you have problems downloading the attachments. Actually just one concern all the cells represented are bitmaps, represented by System.Drawing.bitmap.

regards
Harendra

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

Re: Controls has dynamic elements which are getting repainted

Post by Support Team » Fri Dec 28, 2012 4:11 pm

Hi Harendra,

Thanks for the snapshots, they helped a lot!
Do you have already tried to add the whole process or the specific classes to the GDI capture list as described in the following blog?
Testing of Legacy Applications
If not please give it a try and please let us know if that helped.

Thanks,
Markus
.
Image

harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Re: Controls has dynamic elements which are getting repainted

Post by harendra » Fri Dec 28, 2012 5:17 pm

Just sent a separate e-mail. please advise.

regards
Harendra

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

Re: Controls has dynamic elements which are getting repainted

Post by Support Team » Mon Dec 31, 2012 2:53 pm

Hello Harendra,

In order to analyze the issue we need more information or access to your application. I sent a few questions to you via email.
Thank you.

Regards,
Bernhard
.
Image

harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Re: Controls has dynamic elements which are getting repainted

Post by harendra » Wed Jan 02, 2013 9:59 am

Hi,

Is there some way of enabling the plugin "Add Class or Process to GDI Capture List", programmatically, I mean through the code?

I require to track the raw elements though code.

Regards
Harendra

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

Re: Controls has dynamic elements which are getting repainted

Post by Support Team » Wed Jan 02, 2013 11:04 am

Hello Harendra,

Unfortunately, it is not possible to add a class or a process to the GDI Capture List via code.
I am afraid that I didn’t catch your issue.
If you want to get attributes of an RawText element using the RxPth you can try to use the following code.
RawText element = @"/form[@title='YourApp']/PathToYourElement/rawtext[@rawtext='text']";
E.g. RawTextValue arrtibute:
Report.Info(element.RawTextValue);
If this will not help please explain your issue in more detail in order to give you a workaround.

Regards,
Bernhard
.
Image

harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Re: Controls has dynamic elements which are getting repainted

Post by harendra » Wed Jan 02, 2013 11:21 am

hi,

Issue is here: When you open a "View spy" then Raw Text Ranorex elements are not shown. Only after adding this manually, I started seeing the Ranorex raw text elements.

So now the question is when I am coding this, can I still get the Ranorex Rawtext elements without adding a GDI class, or will there be a situation when the Ranorex raw text elements don't exist during the run time.

regards
harendra

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

Re: Controls has dynamic elements which are getting repainted

Post by Support Team » Wed Jan 02, 2013 3:10 pm

Hello Harendra,

Did you add the process name to the GDI capture list? If you do so all RawText elements should be shown if you open Spy.
It should be not necessary to add the classes to the GDI capture list every time you open Ranorex.
If you take a look into the 'GDI Capture Settings' you should see all classes and processes which were added to the list. The settings can be found if you open the main 'Settings' dialog within Ranorex Spy and click the 'GDI Capture Settings' button.

Regards,
Bernhard
.
Image

harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Re: Controls has dynamic elements which are getting repainted

Post by harendra » Wed Jan 02, 2013 3:58 pm

Hi,

No ,I think I have misled you.

Actually, for making a GDI capture list plugin to work on one machine, I can enable the plugin and then write some code.

But if you port the same code having ranorex but GDI plugin setting not yet made, would the rawtext elements be still visible or again I have to manually enable the plugin?

Regards
Harendra

harendra
Posts: 15
Joined: Fri Aug 17, 2012 3:32 pm

Re: Controls has dynamic elements which are getting repainted

Post by harendra » Thu Jan 03, 2013 12:01 pm

Hi,

Any updates, will the plugin setting be enabled automatically if I port the solution from one machine to another.

Regards
Harendra

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

Re: Controls has dynamic elements which are getting repainted

Post by Support Team » Thu Jan 03, 2013 2:16 pm

Hello Harendra,

Ah, now I think I understand what you want to do.
If you want to use your solution on another computer you have to transfer the GDI capture settings to the new machine.
To do so you can copy the entry within the GDI Capture list from the old machine and add the entries to the list on the new machine.
gdi-capture-list-7.jpg
gdi-capture-list-7.jpg (10.09 KiB) Viewed 1017 times
Regards,
Bernhard
.
Image