My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit and update your bookmarks.

Monday, 23 November 2009

Workaround: Flash selenium test would not run in firefox 3.5 except when the browser mode is *firefoxProxy

I looked into flash selenium a few weeks back and i thought it was a great way for me to test certain part of the apps i have been ignoring for some time.

However after knocking up a few test i discovered that my test would not run in my version of firefox (3.5). I got this error:

INFO - Got result: ERROR: Threw an exception: NPMethod called on non-NPObject wrapped JSObject! on session 471c65508e46457fa43f4deb873d0592
Then i read in some issue raised in the flash selenium site that flash selenium would only work in firefox 3.0 and it worked fine in IE for me.

Today while i was investigating another issue, i decided to try running the flashSelenium test in the "*firefoxproxy" mode and my tests ran succcessfully.

I am sure this workaround would be welcome by people facing this issue as well, please leave a comment if this is any help.



Sachin said...

That is great news buddy! Thanks for that. I'll give it a shot once and if all goes well i'll post it up on the homepage.

Thanks again.

Becky said...

Thank you!

Indian said...

can you please explain how you used "*firefoxProxy", still I'm facing issue with running scripts.

can you please paste sample code here


Anonymous said...
This comment has been removed by a blog administrator.
leumascom said...

@Indian, I would rather you paste a sample of the error you get when you run your tests and also a code copy of the line that starts selenium rc would be good ..

leumascom said...

on a secodn thot, if it help

selenium = new DefaultSelenium("localhost", 4444, *firefoxproxy,;


sumush said...

thanks a ton. that helped.

Vikram said...

Hi leumascom,
Please find below error meesage

-------------17:24:29.445 INFO - Java: Sun Microsystems Inc. 14.3-b01
17:24:29.446 INFO - OS: Windows 7 6.1 x86
17:24:29.456 INFO - v1.0.1 [2696], with Core v@VERSION@ [@REVISION@]
17:24:29.554 INFO - Version Jetty/5.1.x
17:24:29.555 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:24:29.556 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:24:29.556 INFO - Started HttpContext[/,/]
17:24:29.566 INFO - Started SocketListener on
17:24:29.566 INFO - Started org.mortbay.jetty.Server@1ac3c08
17:24:29.646 INFO - Checking Resource aliases
17:24:29.652 INFO - Command request: getNewBrowserSession[*firefoxproxy,, ] on session null
17:24:29.658 INFO - creating new remote session
17:24:29.784 INFO - Allocated session 83e50a719ba947d6a872137826f14d4b for, launching...
17:24:29.784 WARN - It looks like your baseUrl ( is pointing to a file, not a directory (it doesn't end with a /). We're going to have to strip off the last part of the pathname.
17:24:29.848 INFO - Preparing Firefox profile...
17:24:32.809 INFO - Launching Firefox...
17:24:36.401 INFO - Got result: OK,83e50a719ba947d6a872137826f14d4b on session 83e50a719ba947d6a872137826f14d4b
17:24:36.409 INFO - Command request: open[, ] on session 83e50a719ba947d6a872137826f14d4b
17:24:37.624 INFO - Started SocketListener on
17:24:39.023 INFO - Got result: OK on session 83e50a719ba947d6a872137826f14d4b
17:24:39.026 INFO - Command request: getTitle[, ] on session 83e50a719ba947d6a872137826f14d4b
17:24:39.036 INFO - Got result: OK,Clicking Colors on session 83e50a719ba947d6a872137826f14d4b
17:24:39.038 INFO - Command request: getEval[this.browserbot.findElement("clickcolors").getColor();, ] on session 83e50a719ba947d6a872137826f14d4b
17:24:39.052 INFO - Got result: ERROR: Threw an exception: this.browserbot.findElement("clickcolors").getColor is not a function on session 83e50a719ba947d6a872137826f14d4b
17:24:39.055 INFO - Command request: testComplete[, ] on session 83e50a719ba947d6a872137826f14d4b
17:24:39.055 INFO - Killing Firefox...
17:24:39.178 INFO - Got result: OK on session 83e50a719ba947d6a872137826f14d4b

Vikram said...

Please find the code as well
import org.openqa.selenium.server.SeleniumServer;
import org.openqa.selenium.server.RemoteControlConfiguration;

import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
//import com.thoughtworks.selenium.SeleniumException;

import com.thoughtworks.selenium.FlashSelenium;

import junit.framework.TestCase;

//import org.openqa.selenium.server.SeleniumServer;

public class GoogleTest extends TestCase{

private FlashSelenium flashApp;
private Selenium browser;
private SeleniumServer serverLauncher;
private RemoteControlConfiguration RC;
File FFpath;

private final static String GREEN = "GREEN";
private final static String BLUE = "BLUE";
private final static String RED = "RED";
private final static String URL = "";

public void setUp()
FFpath = new File("c:\\custom-profile");

RC = new RemoteControlConfiguration();

//serverLauncher = new SeleniumServer(RC);
serverLauncher = new SeleniumServer();

browser = new DefaultSelenium("localhost", 4444, "*firefoxproxy",URL);
flashApp = new FlashSelenium(browser, "clickcolors");;

}catch(Exception e){

public void tearDown()


public void testColorTransition()
assertEquals("Clicking Colors", browser.getTitle());

public void testRectangleLabel()
assertEquals("(Click here)","getSquareLabel"));"setSquareLabel", "Dummy Label");
assertEquals("Dummy Label","getSquareLabel"));


leumascom said...

I think you asked the same problem here:

I looked into this and i used the suggestion given on the page and it now works.

flashApp = new FlashSelenium(browser, "coloredSquare");

and not

flashApp = new FlashSelenium(browser, "clickcolors");

if you are still having problems, send me an email to as i think the issue is different from what this topic addresses

Gowri said...

when I use firefoxproxy all I get ia an empty firefox window and it hangs there :(

My Code:
import com.thoughtworks.selenium.*;
import com.thoughtworks.selenium.FlexUISelenium;
import com.thoughtworks.selenium.SeleniumException;
import java.util.regex.Pattern;

import junit.framework.*;

public class FlexSample extends TestCase {
private FlexUISelenium flexUITester;
private Selenium browser;

private final static String URL = "file:///C:/Documents%20and%20Settings/qqsics/Desktop/FlickrRIATest/bin-debug/FlickrRIATest.html";

public void setUp() {
browser = new DefaultSelenium("localhost", 4444, "*firefoxproxy",URL);
flexUITester = new FlexUISelenium(browser, "FlickrRIATest");;

public void tearDown() {

public void testColorTransition() {
try { Thread.sleep(10000); }
catch (InterruptedException ex) { }
try { Thread.sleep(10000); }
catch (InterruptedException ex) { }"Search");
try { Thread.sleep(10000); }
catch (InterruptedException ex) { }

public static Test suite() {
return new TestSuite(FlexSample.class);

public static void main(String args[]) {;

Vikram said...

Today I'm seeing strange error after using selenium = new DefaultSelenium("localhost", 4444, *firefoxproxy,;

error: Got result: Illegal operation on WrappedNative prototype

Can you please share how to got the value "*firefoxproxy" as browserstartcommand; as java doc help for Selenium RC Java doesn't have this one


Islam El-Ashi said...

Thanks a lot for the tip! Worked for me.

Anonymous said...

Thanks buddy !!!! It helped me...

Gergely said...

Thanks man!! Your post helped a lot!!

I love green said...

Thanks info in your post helped me a lot... thank you

I love green said...
This comment has been removed by the author.
Dean said...
This comment has been removed by a blog administrator.
mamta said...

Can you please tell me how can i automate selenium for my web application which is using flash...
i am not able to get how to get values from flash chart for comparision there any ebook regarding flash selenium .please let me id is

Anonymous said...

Thanks so much it really helped me :)