Can not we record operations with "id" of Flex component?

Ranorex Spy, Recorder, and Studio.
Shigeru
Posts: 7
Joined: Mon Nov 26, 2012 3:32 pm
Location: Japan
Contact:

Can not we record operations with "id" of Flex component?

Post by Shigeru » Mon Nov 26, 2012 3:39 pm

I just tried Ranorex for a few hours with Adobe AIR application which is built by Flex.

It recorded XPath of the components.
When I changed components position, then it does not work at all.

Can not we record operations with "id" of Flex component?

thanks

Shigeru Nakagaki

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

Re: Can not we record operations with "id" of Flex component?

Post by Support Team » Mon Nov 26, 2012 5:08 pm

Hello,

If you want to change the behavior how Rnaorex should recognize the elements you can use 'RanoreXPath Weights Editor' which can be accessed via the General settings dialog.
GeneralSettings.png
GeneralSettings.png (44 KiB) Viewed 1248 times
Add a new Rule by clicking the green plus.
PathWeightsEditor.png
PathWeightsEditor.png (34.43 KiB) Viewed 1248 times
After that, you can define the weight of the attribute which should be preferred for the object recognition.
PathWeights.png
PathWeights.png (12.77 KiB) Viewed 1248 times
I hope I could help!

Regards,
Bernhard
.
Image

Shigeru
Posts: 7
Joined: Mon Nov 26, 2012 3:32 pm
Location: Japan
Contact:

Re: Can not we record operations with "id" of Flex component?

Post by Shigeru » Mon Nov 26, 2012 6:59 pm

I see!!

thank you, Bernhard :D

I'll try this at company today.


Shigeru Nakagaki

Shigeru
Posts: 7
Joined: Mon Nov 26, 2012 3:32 pm
Location: Japan
Contact:

Re: Can not we record operations with "id" of Flex component?

Post by Shigeru » Tue Nov 27, 2012 10:45 am

Hello, Bernhard.

I tried what you told me. It worked.

However, when I changed UI structure, it did not work at all.

Step1 : set source like bellow
<s:VGroup>
<s:TextInput id="hoge"/>
</s:VGRoup>

Step2 : record operation ( just click the target )

Step3 : play the operation

Step4 : set source like below
<s:VGroup>
<s:HGroup>
<s:TextInput id="hoge"/>
</s:HGroup>
</s:VGRoup>

Step5 : Ranorex could not find "hoge".


thanks

Shigeru Nakagaki

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

Re: Can not we record operations with "id" of Flex component?

Post by Support Team » Tue Nov 27, 2012 2:29 pm

Hello,

The problem is that the RanoreXPath of your element changes if you insert a new layer in your application. The RanoreXPath of the element in the repository will not be changed. That's the reason that Ranorex is not able to find the element because of the wrong path.

E.g.
Old path: flexobject/container/container[@type='VGroup']/text[@id='hoge']
Path after changing the source: flexobject/container/container[@type='VGroup']/container[@type='HGroup']/text[@id='hoge']

To solve this issue you can change the path in the repository to the second one or you can change the path to the following.
flexobject/container/container[@type='VGroup']//text[@id='hoge']

Regards,
Bernhard
.
Image

Shigeru
Posts: 7
Joined: Mon Nov 26, 2012 3:32 pm
Location: Japan
Contact:

Re: Can not we record operations with "id" of Flex component?

Post by Shigeru » Wed Nov 28, 2012 5:09 am

Hello, Bernhard.

Thank you for your advice. But changing repository does not solve our issue.
Because we do not want to edit repository. We need a way to find item by Flex way.
"id" in Flex does not mean component itself identity actually but it means one of "document" properties.
The "document" means the container which is made by MXML.

MXML component has "id", "document" and "parentDocument".
I expected this hierarchy for Flex as the first search. XPath is a second search.

I guess, whenever we change screen design a little bit, we have to change Ranorex repository too, right?
Well, it will make human errors like programing and it will take cost. :(


thanks

Shigeru Nakagaki

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

Re: Can not we record operations with "id" of Flex component?

Post by Support Team » Wed Nov 28, 2012 5:44 pm

Hello,

I am afraid that I don't understand your needs in detail.
Is it correct that you want to recognize the element using the absolute RanoreXPath to the element and the id/document/parentDocument properties?

If you change your application as you described in your post the absolute RanoreXPath of the element will no longer work. As workaround you could change your path to:

flexobject//text[@id='hoge' and @document='someValue' and @parentDocument='someValue']

It will take more time to find the element, but the path should also work e.g. if you insert a new 'HGroup'.
Please correct me if I'm wrong.
Is it possible to get a Ranorex Snapshot file from your application?

Regards,
Bernhard
.
Image

Shigeru
Posts: 7
Joined: Mon Nov 26, 2012 3:32 pm
Location: Japan
Contact:

Re: Can not we record operations with "id" of Flex component?

Post by Shigeru » Thu Nov 29, 2012 3:13 am

Hello, Bernhard.

> flexobject//text[@id='hoge' and @document='someValue' and @parentDocument='someValue']

No, I didn't mean that.

If object structure on runtime is like bellow

<Stage>
<SystemManager>
<ViewClassA> ( <- Class made by MXML)
<some-ContainerA id="c1"> ( <- Class made by MXML)
<some-ContainerB>
<some-ComponentC/>
</some-ContainerB>
</some-ContainerA>
<some-ContainerA id="c2"> ( <- Class made by MXML)
<some-ContainerB>
<some-ContainerC>
<some-Component id="hoge"/>
</some-ContainerC>
</some-ContainerB>
</some-ContainerA>
<ViewClassA>
</SystemManager>
</Stage>

In Flex, "hoge" can be identified by like bellow
flexobject > container > container [@type="ViewClassA"] > container [@id="c2"] > component [@id="hoge"]

Because
hoge.document == c2 ( "document" property of "hoge" is c2. )
c2.document == ViewClassA ( "document" property of "c2" is ViewClassA )

So,
"hoge" can be specified by ViewClassA.c2.hoge in Flex.
In Flex, the component which has id can be specified regardless of actual layer structure.

However, there are a lots of components which does not have "id".
So we need two way to identify component.

way 1 : identify with "id" ( We do not need to care about a layered structure much in the class which is made by MXML. )
way 2 : identify with XPath ( We have to care about a layered structure. )


thanks

Shigeru Nakagaki

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

Re: Can not we record operations with "id" of Flex component?

Post by Support Team » Thu Nov 29, 2012 3:52 pm

Hello,

Ranorex uses the RanoreXPath to recognize the elements and needs some properties to identify the elements, e.g. container[@caption='some-ContainerB'].

Does your container have such a property?
Is it possible to get a Ranorex Snapshot from your application?

You can find a detailed description how to work with RanoreXPath expressions in the section RanoreXPath and how to use the Repository in the section UI Mapping with Ranorex Repository in our user guide.
Additionally i would suggest to participate in a webinar where one of my colleagues will explain how to work with Ranorex and some ways to identify elements.

Regards,
Bernhard
.
Image