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 some usage examples to create automated tests for MyAppInFlex.swf, and also serve 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");
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 Gridselenium.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 valueselenium.flexAssertProperty("id=MyAppInFlex", "chain="id:emailTextBox, validator=text|emailvalue@domain.com", );
To improve the application testability, add id’s to the objects you want to access. This also applies for web application in general (accessing elements by id’s 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.