Monday, December 1, 2008

FunFX 0.2.0

Hi everybody

I am sorry about the slow update rate of this blog. I have lately been developing the new FunFX. It is still located at

We are going to release it on Rubyforge soon, but please try it by downloading it from github.

It is much better that the first version, and there are just small changes you need to do to your test scripts.

- Peter


r said...

Hi Peter,
Is the place to ask?
We want to use the latest and greatest FunFX. I'm having great difficulty compiling from the source. Would it be possible to get a zip similar to the 0.0.4 version? Even if the source were a bit out-of-date, we could get started with a proof of concept.

Navarasu said...
This comment has been removed by the author.
Navarasu said...

hi Peter!
Still now i using Funfx-0.0.4 version.
I installed the new version FunFx-0.0.2. But i m helpless in how to script with new funfx especially about start up script....
Can u help me plz...
Thanks for ur reply....

Peter Motzfeldt said...

Hi, the source should be out on Rubyforge along with the gem (, but it is also possible to download the lest source code directly from github (

Peter Motzfeldt said...

Hi, I have cleared this afternoon to get some startup guides ready for the new FunFX. This holliday went to fast.

Let me know if there is something specific.

Navarasu said...
This comment has been removed by the author.
Navarasu said...

Hi Peter !
I m expecting for ur next post regarding the startup guide for new FunFx. Still i m using the old version ...

Darren Bishop said...

Hi, I am trying to run the demo app with the cucumber tests; this is from a git clone.

I get the following error:

Feature: Select date # cucumber-features/select_date.feature
In order to make a date
Daters should be able to pick a date for a date
Scenario: Christmas eve # cucumber-features/select_date.feature:5
Given I am on the new date page # cucumber-features/step_definitions/date_steps.rb:1
ReferenceError: Error #1069: Property id not found on String and there is no default value. (FunFX::Flex::FunFXError)
UNKNOWN:in `funfx.flexlocator::FlexObjectLocator/findAutomationObject()'
UNKNOWN:in `funfx::Proxy/replayFunFXEvent()'
UNKNOWN:in `funfx::Proxy/fireFunFXEvent()'
UNKNOWN:in `Function/'
UNKNOWN:in `<anonymous>()'
UNKNOWN:in `flash.external::ExternalInterface$/_callIn()'
UNKNOWN:in `<anonymous>()'
C:/Dev/Ruby/1.8.6/lib/ruby/gems/1.8/gems/funfx-0.2.2/lib/funfx/flex/element.rb:90:in `raise_if_funfx_error'
C:/Dev/Ruby/1.8.6/lib/ruby/gems/1.8/gems/funfx-0.2.2/lib/funfx/flex/element.rb:67:in `flex_invoke'
C:/Dev/Ruby/1.8.6/lib/ruby/gems/1.8/gems/funfx-0.2.2/lib/funfx/flex/element.rb:26:in `fire_event'
C:/Dev/Ruby/1.8.6/lib/ruby/gems/1.8/gems/funfx-0.2.2/lib/funfx/flex/elements.rb:1087:in `open'
./cucumber-features/step_definitions/date_steps.rb:3:in `Given /^I am on the new date page$/'
cucumber-features/select_date.feature:6:in `Given I am on the new date page'
When I select date Feb 28 1971 # cucumber-features/step_definitions/date_steps.rb:7
Then I should see Feb 28 1972 as my date # cucumber-features/step_definitions/date_steps.rb:13

1 scenario
1 step failed
2 steps skipped

I am aware the data for the navigation tree is inline XML i.e. text, so I'm wondering if that's the reason the framework is trying to lookup :id on a String?

I can't seem to find anyone else having this problem... strange, as I haven't really changed anything.

Your help would be appreciated.

Witek said...


I have the same error as Darren Bishop mentioned. I took the source code from git repository and tried to run the example. I got the message like "Property id not found on String and there is no default value."
Also I prepared a simple flex application with a button and wrote a test which suppose to click that button; I got still the same error.
So I started digging. Looks like there is a type mismatch between ruby FunFX gem library and SWC library.
There is a function "fire_event" located in funfx-0.2.2/lib/funfx/flex/element.rb file. Looks like this function makes a call to the flex SWC library by calling

@flex_app.fire_event(@flex_locator, event_name, flex_args)

In the source code the flex_locator is a string variable which in my case looks like "{parent: null, id: {id: 'guzik'}}" where 'guzik' is a button id (I want to click that button).
Lets analyze what is going on in the SWC library. Please have a look into a file. There is a function defined as:
replayFunFXEvent(locator:Object, eventName:String, args:Array) : String
This function is called from a ruby gem. The first argument is declared as Object, but ruby sends a string. The function replayFunFXEvent tries to get id variable from the locator object in the way: locator["id"] and in that place we have an error because it can not read the id variable from a string object. Looks like locator object should be defined as a class with at least two attributes (id an parent). I changed a little the file so it first parses the input string and gets "id" and "parent" variables; now it works - I've got no error but there is another problem: looks like the button does not get clicked (when clicking the button a message box should appear with some information). When I click the button manually the message box is shown but using FunFX nothing happens.



Peter Motzfeldt said...

Hi, what browser do you use to run the example?

Because there is a bug in the FunFX version for IE, and the error you get kind of looks like the bug in the IE version.

The reason why IE does not work for the moment is that when the ruby side contacts the swc, the information should be read as an actionscript object. This works fine for both Safari and Firefox becuase we use javascript to contact the swc. But with IE it is read as a string.

I have not yet found a way to get around this with IE. Do any of you have any idea on how to use WIN32OLE and use javascript?

But if you do not use IE, then I am not quite sure why you get this error. Then I need to think a bit more.

Witek said...

Hi Peter,

Indeed, I'm using IE. Try to use Firefox and see the results. Thank's for quick response.



Peter Motzfeldt said...

Remember that you need this plugin in firefox to get Firewatir running.

Hope this get things right :-)

Darren Bishop said...

Hey all. Yes I did not see the post/documentation saying IE was not supported... real "Doh!" moment. I also had only searched the Firefox Addons site for the JSSh plugin, but since found it, like Peter pointed out, on the OpenQA website.

All works fine now on Firefox testing the demo-app.

I am having an issue however accessing (get-only)properties/fields/consts of a custom component; I eventually managed to access these, but the value is always 0. Strange. Any ideas?

ps. FunFX + Cucumber = Too Cool

Kaustubh said...

Hi Peter,

I tried using funfx (0.2.2) to automate flex application on firefox. I followed the steps mentioned in

I am able to go to the page containing my Flex application. After that I get reference to the Flex application (id, name is correct) but it does not work to access Flex elements with Automation IDs.
example: I tried following
@flex.button(:id => “login”).click()

but it did not clicked the button or not even gave error.. :(

Is there anything I am missing?

Peter Motzfeldt said...

That is strange...

And you are sure that login is the id not the automationname of the component? And there cannot be other components that has the id "login" that it encounters before if finds the button login?

Darren Bishop said...

Whoops, my bad. I should have said...

Flex-Mojos + FunFX + Cumcumber = Uber Cool

It turns out my pom.xml was not configured correctly. I created a 'funfx' profile as suggested where the normal Flex framework libs are specified, but with internal scope. I think this is important as I believe merge scope (default) APIs/libraries are only linked in if they are used. I figured the automation libs are called at runtime via the ExternalInterface mechanism, making the compiler un-awares, thus the need for internal to force the issue.

I also hadn't installed the sdk properly... Flex-Mojo to the rescue.

NB: it looks like rb.swc is now the preferred packaging/type for resource bundles, replacing resource-bundle.

My features now run green.


Kaustubh said...

Sorry for late reply...

Yes, "login" is id and not automationname...

Here is my code:

require 'funfx/browser/firewatir'
browser =

flex = browser.flex_app('rui','rui')
flex.button({:id => "login"}).click()

Above code does not work...

1.Does 'settings.jsp' in url make any difference?

2. If I print 'flex' I get following error :
c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:967:in `assert_exists': Unable to locate element, using nil (Watir::Exception::UnknownObjectException)
from c:/ruby/lib/ruby/gems/1.8/gems/firewatir-1.6.2/lib/firewatir/MozillaBaseElement.rb:1097:in `to_s'

Darren said...

Hi Peter,

At he top of all your files it says "require 'funfx'" but this is causing problems for me what file does it require?

XeandeR said...

I have the following set of commans

require 'funfx'
require 'funfx/browser/firewatir'

@flex_app = BROWSER.flex_app('FlexTest', 'FlexTest')

@flex.button(:automationName => “Button”).click

Noe what happens is firefox browser will open up . But the button click (or any actions) are not taking place.I am not getting any errors while executing the code .. Please help ... i followed all the steps as mentioned in start up guide ""
I used funfx-0.2.2.swc files

Guillermo A. Romero Ramírez said...

I have the same issue as XeandeR has anyone been able to fix this?

Firefox loads just fine, goes to the page and everything but nothing happens in the flex app...