Click here to Skip to main content
13,091,537 members (68,609 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


3 bookmarked
Posted 4 Oct 2010

Setting Up Flex Testing with Selenium

, 4 Oct 2010
Rate this:
Please Sign up or sign in to vote.
How to set up Flex testing with Selenium

Recently, I was looking for tools to support automated testing for flex applications. I have a test suite in SeleniumRC and C#. I was looking for options to continue using this environment. Here’s what I found:

FlashSelenium, Selenium Flex API

These two projects provide capabilities to interact with Flex UI components and web pages through selenium RC.

Selenium Flex API automatically exposes Flex APP UI and FlashSelenium allowing us to call ActionScript methods to interact with Flex elements. Note that this approach requires us to compile our flex applications with Selenium Flex API library.

To start coding your test:

  • Rebuild your Flex application with sfapi.swc add the compiler argument: -include-libraries "..\libs\sfapi.swc"
  • Include FlashSelenium.dll library in the seleniumRC test project.

To be able to run test on Firefox, you need to specify the browserString *firefoxproxy instead of *firefox since Firefox doesn't like JavaScript calling Flash when JavaScript comes from another window (the way Selenium calls Flash objects).

This is a “hello world” example:

public class MyAppInFlexTest
    private ISelenium selenium;
    private FlashSelenium.FlashSelenium flashApp;

    public void SetupTest()
        selenium = new DefaultSelenium("localhost", 4444, @"*firefoxproxy", 
        //selenium = new DefaultSelenium("localhost", 4444, @"*iexplore", 
        //selenium = new DefaultSelenium("localhost", 4444, @"*googlechorme", 
        flashApp = new FlashSelenium.FlashSelenium(selenium, "MyAppInFlex");

    public void TeardownTest()

    public void TestMethodFlashSelenium()
        flashApp.Call("doFlexType", "usernameTextInput", "from selenium flex");
        flashApp.Call("doFlexClick", "secureCheckBox", "");


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


About the Author

Denmark Denmark
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170813.1 | Last Updated 4 Oct 2010
Article Copyright 2010 by mariangemarcano
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid