About Me

My photo
I have not claimed perfection. Perfect, I cannot be. Because I am human and prone to make mistakes. I have learned that failure is not a character flaw, It is part of the human make-up. I live, I laugh, and I also learn, my knowledge is incomplete. I am searching all the time, in waking hours and in my sleep. I have a long road to travel and I will learn lessons on the way. Wisdom I shall learn. Accept me as I am, Because I am me. There is no one like me in this world , and that is my only guarantee

Wednesday, 22 June 2011

Selenium – Flex Integration Steps

Selenium – Flex Integration Steps

Download the following
• Install Selenium-IDE (if the link is problematic, download at http://release.seleniumhq.org/selenium-ide/1.0.10/selenium-ide-1.0.10.xpi and open it in Firefox, or see here). If the Selenium IDE window appears, you can just close it.
• Install the FlexMonkiumConsole by running the FlexMonkium installer. Please make a note of where you install the executable because you will need to tell the Firefox plugin where it can find it. When the installation completes, the FlexMonkiumConsole window will appear (a small application window with three buttons); you can close it for now.
• Download and unzip the FlexMonkium zip file. It contains:
o flexmonkium.xpi - The FlexMonkium Firefox extension installer.
o User-extensions.js - The FlexMonkium extensions for Selenium-RC.
• Install the FlexMonkium Firefox plugin by opening flexmonkium.xpi in Firefox.
• Flex_SDK 4.5
• Flash Builder 4

Preparing Flex SWF’s for use with Selenium

Open your Flash Builder
• Create new flex project
• Create one MonkeyContacts.mxml,PhoneGridItemRenderer,MonkeyContact.as files under in src folder
Copy the appropriate version of automation_monkey.swc (from the FlexMonkium.zip download) to the project's libs folder. For Flex 4, use automation_monkey4.x.swc. For 3.4 or 3.5, use FlexMonkey3.x.swc. For 3.2 or 3.3, use automation_monkey3.2 or automation_monkey3.3, respectively.
1. Select the above created Project > Properties window in FlashBuilder
2. On the Flex Build path panel>Select libs folder>Click Add SWC button-Add Your automation_monkey4.x.swc file
3. On the Flex Compiler panel, add the following Additional Compiler Arguments:
-locale en_US-include-libraries libs/ automation_monkey4.x.swc

Once Build is Successful your project bin-debug system creates one MonkeyContacts.SWFfile with html and other files.

Recording Test Script use with Selenium IDE

• Open Selenium IDE in Firefox Browser and make sure by default it should be recordable.
• Now open your Created MonkeyContacts.html File in Firefox Browser
[Like:- file:///D:/Srini/Selenium_Flex_Demo/MonkeyContactsExample/bin-debug/MonkeyContacts.html]
• Do some validations on the Monkey Contacts Application.
• Now Selenium IDE able to identify your flex objects successfully. And we are able to replay again without any errors

Creating an Code for Selenium-RC

• FlexMonkium generates JUnit-based tests for use with Selenium-RC. To generate a test, select Options...>Format…> FlexMonkium (JUnit) – Selenium-RC from the Selenium-IDE File menu.
• Copy the FlexMonkium Code Selenium IDE.
• Launch the Eclipse IDE and create a one java project in Eclipse IDE include needed .jar files
• Create one Class and name it as any [like Flex Test]
• Paste the entire copied FlexMonkium Code under class file from the Selenium IDE
Please find the following flex code for sample with Selenium RC
package sample;
import com.thoughtworks.selenium.*;
import org.junit.*;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

public class FlexTest {
private Selenium selenium;
private HttpCommandProcessor proc;
public void setUp() throws Exception {
proc = new HttpCommandProcessor("localhost", 4444, "*firefox", "file:///D:/FlexMonkey/MonkeyContactsExample/bin-debug/MonkeyContacts.html");
selenium = new DefaultSelenium(proc);
public void tearDown() throws Exception {
if (selenium != null) {
selenium = null;
public void myTestMethod() throws Exception {
for (int t = 0;; t++) {
if (t >= 80) fail("timeout");
try {
if (proc.getBoolean("isFlexMonkey", new String[] {" "})) break;
} catch (Exception e) { }
for (int t = 0;; t++) {
if (t >= 60) fail("timeout");
try {
if (proc.getBoolean("isFlexMonkey", new String[] {""})) break;
} catch (Exception e) { }
• Now we are going to Launch the Selenium-Server
• When starting the Selenium-RC server, you must include the FlexMonkium extensions by supplying a path to FlexMonkium’s user-extension.js file.
java -jar selenium-server.jar -userextensions /pathToFlexMonkium/user-extensions.js

Example:- D:\Engines>java -jar selenium-server.jar -userextensions /"D:\Flex Monkium\FlexM
Run Test Script with Junit Engine it will generates the test reports.


  1. Please make a note of where you install the executable because you will need to tell the Firefox plugin where it can find it.--- i can not understand.please explain in details.

  2. Hi Vasu,

    I am using FF10 and when I try to record the events using flex-monkium it is unable to connect to SWF..
    Please help

  3. i am not able to install felxmoniumconsole using adobe air. getting error as diginital signaure invalid.
    do you have any other alternative for resolve this issue or is there any opensource tool for automating flex web applications

  4. I am not able to install Flex Monkium Console. Getting following error.

    "The application could not be installed because the installer file is damaged. Try obtaining a new installer file from the application author."

    Please help

  5. Please tell me where i can download flexmonkium console. (are flex monkium console and flexmonky console same or different?). If same where i can downlaod them please help me.

    Please help

  6. This comment has been removed by the author.

  7. Because the guys in Gorilla Logic ditched the project in 2012, the code signing certificate for both flex monkium and flex monkey have expired, hence the instalation broken error. As a workaround to this, change the date and time of windows for april 2012. the instalation should work.