Click here to Skip to main content
Click here to Skip to main content
Technical Blog

Tagged as

Automating MyAppInFlex.swf – Useful FlexPilot commands

, 24 Oct 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Useful FlexPilot commands

I continue automating my Flex application with FlexPilot. One clear advantage I found when using FlexPilot is that I was able to access more of the UI elements of a complex Flex interface. The other tools I tried weren't picking all those elements, but I must admit that I didn't investigate further.

An interesting feature is FlexPilot’s chain syntax, that allows to access flex UI elements by different properties, like id, label or text. Another feature I liked is easier integration to work with selenium RC and selenium IDE.

Below are some usage examples to create automated tests for MyAppInFlex.swf, and also server as a quick reference on how to interact/access the flex UI.

Click on a Button

The easiest way to access an element is using the element’s id, for example click on a button:

selenium.flexClick("id=MyAppInFlex", "chain=id:okButton");

If the button you are trying to access doesn't have an id, you are able to find it using the label property:

selenium.flexClick("id=MyAppInFlex", "chain="id:buttonBar/label:Search");

Access an Element on a Grid

Click an element that has an specific value on a Grid:

selenium.flexClick("id=MyAppInFlex", 
"chain="id:userGrid/name:AdvancedListBaseContentHolder*/name:
AdvancedListBaseContentHolder*/text:Maria Marcano");

Check the Value on a TextInput

Check a textbox has a specific value:

selenium.flexClick("id=MyAppInFlex", "chain="id:emailTextBox, 
validator=text|emailvalue@domain.com", );

To improve the application testability, add ids to the objects you want to access. This also applies for web application in general (accessing elements by ids is faster than processing xpath expressions).

Some Limitations

Elements on a grid can't be accessed by position, for example click on the first/second element on a grid.

I've been experiencing some issues with some application builds that prevent the use of the flex explorer and recorder (reported the bug, hopefully it gets fixed soon). You can still run the tests, just not using those tools to capture the elements.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

mariangemarcano

Denmark Denmark
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web02 | 2.8.141022.1 | Last Updated 24 Oct 2010
Article Copyright 2010 by mariangemarcano
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid