Unable to use Click Flex Element on Flex Datagrid scroller component

1,353 views
Skip to first unread message

Daniel Chew

unread,
Dec 10, 2013, 10:42:41 PM12/10/13
to robotframe...@googlegroups.com
Hi,

I am trying to automate the clicking of Flex Datagrid scroller component. But when I use the Selenium IDE to identify the target and value, the chain returns a lot of name elements that seems to change every time my application is refreshed. It's never the same. Here's the example below.

chain=automationName:main/name:ApplicationSkin2/automationName:_ApplicationSkin_Group1/automationName:contentGroup/automationName:main/automationName:vbox/automationName:screenArea/name:ScreenContainer293/name:ScreenContainerSkin294/automationName:contentGroup/name:moduleInnerClass0_253/automationName:contentArea/name:ContentPanelSkin308/automationName:mainLayout/automationName:contentGroup/automationName:taskGrid

chain=automationName:main/name:ApplicationSkin2/automationName:_ApplicationSkin_Group1/automationName:contentGroup/automationName:main/automationName:vbox/automationName:screenArea/name:ScreenContainer293/name:ScreenContainerSkin294/automationName:contentGroup/name:moduleInnerClass0_253/automationName:contentArea/name:ContentPanelSkin308/automationName:mainLayout/automationName:contentGroup/automationName:taskGrid/automationName:_XXXDataGrid_Group1/automationName:_XXXDataGrid_HGroup9/automationName:advancedDataGrid/name:VScrollBar1055/name:Button1062


The number besides the names seems to be dynamically generated internally in the component.

Is there a way to automate this clicking on the DataGrid scroller?


Best regards,
Daniel Chew

Pekka Klärck

unread,
Dec 11, 2013, 3:44:08 AM12/11/13
to chewse...@gmail.com, robotframework-users
2013/12/11 Daniel Chew <chewse...@gmail.com>:
>
> I am trying to automate the clicking of Flex Datagrid scroller component.
> But when I use the Selenium IDE to identify the target and value, the chain
> returns a lot of name elements that seems to change every time my
> application is refreshed. It's never the same.

First of all, are you use Robot Framework and SeleniumLibrary for Flex
testing? If not, what is your tooling?

If I remember correctly, there was a possibility to use wildcards in
chains used by Flex Pilot that SeleniumLibrary uses for Flex testing.
This is something you need to check yourself, though. A better
solution would be changing your app so that ids/names are not
generated dynamically. That makes test automation unnecessarily
complex regardless the UI technology.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

Daniel Chew

unread,
Dec 11, 2013, 4:55:11 AM12/11/13
to robotframe...@googlegroups.com, chewse...@gmail.com
Hi Peke,

Yes. I am using RobotFramework and Selenium Library.

And yes again there is a way to use wild card for that too. I have tried using that but it doesn't work. The DataGrid component is not a component that I created but part of the Flex component, so it seems that it dynamically generates the name. I do not have any control on it.

Tatu Aalto

unread,
Dec 11, 2013, 1:58:04 PM12/11/13
to robotframe...@googlegroups.com
Ugh

Dynamically created elements are difficult or sometimes impossible to automate. Sometimes there are elements that are not dynamically created, example icons, text or so on, that you can use to access elements. Usually these are quite difficult to find, but by using good tools [1] those might be possible to find. Or as a workaround, there might be static elements and x-number of element from static element is your dynamic element. You could use css :nth-child(n) [2] or in xpath it is possible to select n element from other element.

But as was said, usually it best to use selectors that are static. Usually for a developer, creating static selectors is not difficult task, if you ask it before hand. So talk your dev, tell what you want and what is your problem and try to solve the problem together.

-Tatu
[1] https://getfirebug.com/
[2] http://www.w3schools.com/cssref/css_selectors.asp
[3] http://www.w3schools.com/xpath/xpath_syntax.asp
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/groups/opt_out.

Daniel Chew

unread,
Dec 12, 2013, 3:48:39 AM12/12/13
to robotframe...@googlegroups.com
Hi Tatu,

Thanks for the advice. It was helpful.

I installed FireBug and FlashFireBug to try to identify the elements. I have also attached the screenshot for that in this post.

Here's an excerpt from http://robotframework-seleniumlibrary.googlecode.com/hg/doc/SeleniumLibrary.html?r=2.8. It shows all the options that are available for accesing Flex elements.

Locating Flex elements

SeleniumLibary 2.6 and newer support testing Adobe Flex and Flash applications using Flex Pilot tool. For more information, including the required bootstrapping, see http://code.google.com/p/robotframework-seleniumlibrary/wiki/FlexTesting By default Flex elements are located based on id they have in Flex source code. Other supported locators are name, automationName, text, htmlText, label and xpath-like chain. To use them, you need to prefix the value with the locator type like name=example. Locators also support * as a wildcard.

Examples:
Click Flex Element                     
 foo            # Search element by id
Click Flex Element 
 name=myName            # Search element by name
Click Flex Element  label=Hello!            # Search element by label text
Click Flex Element  chain=id:someId/name:someName 
           # Search element first by id and then its child by name
Click Flex Element  name=wild*            # Name with wildcard
Click Flex Element  chain=name:*llo/name:world            # Chain with wildcard


Here is my how my RobotFramework calling method looks like:-

Click Flex Element    chain=automationName:taskGrid/automationName:_XXXDataGrid_Group1/automationName:_XXXDataGrid_HGroup9/automationName:advancedDataGrid/name:VScrollBar*/Button[2]


Looking at my chain above, I am able to call until VScrollBar but when it comes to the button, I can't seem to get it right. If you refer to my screenshot attachment you can see that it has 3 buttons under it. The last button is the one that I want to click but is not able to. I tried to use the xpath to access that particular element but it always fails unless there is something wrong with my syntax.

Do you know what is wrong? Or is this even possible? Because from the documentation, it only shows how to use chain using the specified attributes such as automation, name, label, etc and also wildcard. Other than that there is not mentioned of being able to use other form of xpath function.

Please help.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.
screen.png

Tatu Aalto

unread,
Dec 15, 2013, 1:49:26 PM12/15/13
to robotframe...@googlegroups.com
Ugh

I have not personally deal with Flex elements, so can not help you any further on the matter. Perhaps someone else on the user group is able to help you.

-Tatu
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages