Page 1 of 1

How to stably get a VSFlexGrid control

Posted: Tue Jan 26, 2010 11:33 am
by will
Hello,

I am currently evaluating Ronarex 2.2.1 and run into a problem with the RanoreXPath.

There are some VSFlexGrid controls in our dialog and Ranorex Spy recognizes them such as: bluh_bluh/element[@controlid='3XXXXXXX'], however, the next time I open that same Grid control, its controlid will become something like controlid='6XXXXXXX'. The replay will fail since it fails to find the previous controlid. Is there any option I can set to make Ranorex not using this changing controlid but some stable property of the control?

Thanks,
Will

Re: How to stably get a VSFlexGrid control

Posted: Tue Jan 26, 2010 4:23 pm
by Ciege
Is there a static yet unique property available for Ranorex to use? Can you see one in RanorexSpy? It sounds like a static & unique property is not available so Ranorex is just getting the ID of the element which can change any given iteration of your AUT.

You can ask your dev team to uniquely name objects in your AUT for automation purposes (best solution for automation). Or you can look for unique properties of the objects in question and modify your automation code to support those unique properties. Or finally you can write some method yourself that is smart enough to figure out what object it is you are looking for based on some properties you determine.

This is not necessarily a failure of Ranorex, yet would be an issue that would need to be solved with *any* automation utility since they have no way of uniquely identifying the objects of your AUT.

Re: How to stably get a VSFlexGrid control

Posted: Thu Jan 28, 2010 5:48 pm
by Support Team
Ciege is right,

ControlId is usually rather stable, but there are cases where it is not.
Have a look at your control with Ranorex Spy and check if there are other unique properties you might use.
What about the classname ? It might work to use @classname and @instance
In the worst case, use index, like this: element[4]

The feature you are talking about is currently experimental and available as a plugin.
I attached the plugin and its configuration as a zip file. Extract those files into
"C:\Documents and Settings\All Users\Application Data\Ranorex2\Plugins" (for Windows XP)
or "C:\ProgramData\Ranorex2\Plugins" (for Vista, 7)

The configuration file allows dynamic setting of path weights (which influence which attributes are used in the path). The file I attached should already fix your problem. Feel free to play around with the configuration.

We plan to add is feature (as a GUI configuration dialog) into a future Ranorex version.

Regards,
Michael
Ranorex Team

Re: How to stably get a VSFlexGrid control

Posted: Thu Jan 28, 2010 10:13 pm
by snowli
Hello, we are evaluating Ranorex and the ActiveX control VSFlexGrid not having a stable ControlID is preventing us from going forward with the evaluation. So we would highly appreciate any help that can convince us to choose your software.

1. Since when the class is VSFlexGrid8L, the ControlId isn't stable, is it possible to use WindowText as the element identifier in the recorder?
We see that the WindowText is listed in the Ranorex Spy (and we can make it stable), although it appears grayed out in Ranorex Spy.

2. After recording, if I manually change the elements line from
element[@controlid=136786992'']/row[@accessiblename='Row 2']/cell[@accessiblename='X']
to
element[@windowtext='myWindowCaption']/row[@accessiblename='Row 2']/cell[@accessiblename='X']

then it works!, but obviously we don't want to manually edit the recorded scripts each time.

So how to set a setting in Ranorex such that it will automatically use @windowtext if the Class name is 'VSFLEXPRO8L'? Or is it possible that we can configure Ranorex so that use classname plus windowtext as identifier when recording?

BTW, we have been using QTP and vsFlexGrid didnt present a problem for that software, but then we ran into other problems like right-click hit-test to open Context menu etc, which prompted us to look for a new software.

Thanks for your help.

Snow

Re: How to stably get a VSFlexGrid control

Posted: Fri Jan 29, 2010 8:18 am
by will
Hi Ciege and Michael,

Thank you very much for your help! I tried the plugin, and YES, this fixes my problem! I can see @class and @instance are automatically used for all the VSFlexGrid controls and the replay executes quite smoothly.

Cheers,
Will

Re: How to stably get a VSFlexGrid control

Posted: Fri Jan 29, 2010 10:23 am
by Support Team
snowli wrote:So how to set a setting in Ranorex such that it will automatically use @windowtext if the Class name is 'VSFLEXPRO8L'? Or is it possible that we can configure Ranorex so that use classname plus windowtext as identifier when recording?
Please, read the previous post from Michael! Using the AttributeWeightPlugin you can adjust the weight of attributes that should or should not be used. E.g. if you want the "classname" and "windowtext" properties to be used, increase the weight of those attributes. Ranorex will then favor these two attributes when building paths for your controls. Vice versa, decrease the weights of attributes you don't want to be used.

Regards,
Alex
Ranorex Support Team

Re: How to stably get a VSFlexGrid control

Posted: Fri Jan 29, 2010 5:16 pm
by snowli
Sorry,

I was not able to get the plugin to work for some reason so I didnt fully understand its purpose. But now that my colleague Wil had succeeded with the plugin and your new post also made things clear for me, so I am pretty sure we will get things working very soon.

Thanks a lot for the great support and we really like the flexibilty of your product.

Snow

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 9:38 am
by edxxgardo
Hello people,

Would you be so kind of explaining me how to set up properly the plugin? I downloaded it in the Plugin forlder, but I don't see where I can set it up in the Recorder or Studio program. Thanks for the help,

Cheers,
Dario

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 9:53 am
by Support Team
Hi Dario,

Just edit the configuration of the file Ranorex.Plugin.RxPathWeights.config for your needs. There's also a description in the file how to configure the file.

Regards,
Peter
Ranorex Support Team

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 10:36 am
by edxxgardo
Thanks again Peter for the support,

Sorry to stress you with my issues, the thing is that I don't want to change the tool:
Using the Recorder I get this RenoreXpath:

body/table/tbody/tr/td/table/tbody/tr[1]/td[2]/form/table/tbody/tr[2]/td/table/tbody/tr[@id='gmd:identificationInfo_64778ad5-2516-4935-a173-fbf036e90392']/td/fieldset/table/tbody/tr[@id='gmd:date_8d43b4ef-010b-4372-a9d6-446919c096bd']/td/table/tbody/tr/td[1]/input[@id='_93_cal']

The two following lines:

<tr id="gmd:identificationInfo_64778ad5-2516-4935-a173-fbf036e90392" type="metadata">
<tr id="gmd:date_8d43b4ef-010b-4372-a9d6-446919c096bd" type="metadata">

are the tr tags in question (in this case).
As you see, apart of the id we have type as attribute, then I changed the RxPath config file to:

<!--
Ranorex RxPath weight override configuration
Use this to tweak paths weights.
-->
<rxpathweights>

<rule capability="tr" attribute="type" setweight="9" conditionsoperator="or">
<condition source="self" attribute="type" match="metadata" negate="false"/>
</rule>

</rxpathweights>

I'm sure that something is wrong in the settings. So, if you have some tips I would really appreciate it.

Thanks again,
Dario

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 11:12 am
by Support Team
Hi Dario,

Try it with following settings, this should work for your case.
<!--
Ranorex RxPath weight override configuration
Use this to tweak paths weights.
-->
<rxpathweights>

<rule capability="trtag" attribute="id" setweight="0" conditionsoperator="or">
<condition source="self" attribute="type" match="metadata" negate="false"/>
</rule>

</rxpathweights>
Regards,
Peter
Ranorex Support Team

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 12:26 pm
by edxxgardo
it does not help Peter, sorry.
Recorder still select the <tr> tag via the id attribute. I hope you have any idea,
Regards,
Dario

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 1:14 pm
by Support Team
Hey dario,

please can you send me an spy snapshot of your website. Just open the spy tool right-click on your webpage and save as snapshot. Send me the file to [email protected] or post it to the thread. So I can have a closer look to the problem.

Regards,
Peter
Ranorex Support Team

Re: How to stably get a VSFlexGrid control

Posted: Fri Mar 12, 2010 1:52 pm
by edxxgardo
I sent the snapshot at [email protected]. Let me know, thanks again


Regards,
Dario