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 471c65508e46457fa43f4deb873d0592Then 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.
Thanks
20 comments:
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.
Thank you!
Hi,
can you please explain how you used "*firefoxProxy", still I'm facing issue with running scripts.
can you please paste sample code here
Thanks,
Vikram
@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 ..
on a secodn thot, if it help
selenium = new DefaultSelenium("localhost", 4444, *firefoxproxy, http://google.com);
selenium.start();
thanks a ton. that helped.
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 0.0.0.0:4444
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, http://flashselenium.t35.com/colors.html, ] on session null
17:24:29.658 INFO - creating new remote session
17:24:29.784 INFO - Allocated session 83e50a719ba947d6a872137826f14d4b for http://flashselenium.t35.com/colors.html, launching...
17:24:29.784 WARN - It looks like your baseUrl (http://flashselenium.t35.com/colors.html) 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[http://flashselenium.t35.com/colors.html, ] on session 83e50a719ba947d6a872137826f14d4b
17:24:37.624 INFO - Started SocketListener on 0.0.0.0:49881
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
-------
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 java.io.File;
//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 = "http://flashselenium.t35.com/colors.html";
public void setUp()
{
try{
FFpath = new File("c:\\custom-profile");
RC = new RemoteControlConfiguration();
RC.setFirefoxProfileTemplate(FFpath);
//serverLauncher = new SeleniumServer(RC);
serverLauncher = new SeleniumServer();
serverLauncher.start();
browser = new DefaultSelenium("localhost", 4444, "*firefoxproxy",URL);
browser.start();
flashApp = new FlashSelenium(browser, "clickcolors");
browser.open(URL);
}catch(Exception e){
e.printStackTrace();
}
}
public void tearDown()
{
browser.stop();
serverLauncher.stop();
}
public void testColorTransition()
{
assertEquals("Clicking Colors", browser.getTitle());
assertEquals(GREEN, flashApp.call("getColor"));
flashApp.call("click");
assertEquals(BLUE, flashApp.call("getColor"));
flashApp.call("click");
assertEquals(RED, flashApp.call("getColor"));
flashApp.call("click");
assertEquals(GREEN, flashApp.call("getColor"));
}
public void testRectangleLabel()
{
assertEquals("(Click here)", flashApp.call("getSquareLabel"));
flashApp.call("setSquareLabel", "Dummy Label");
assertEquals("Dummy Label", flashApp.call("getSquareLabel"));
}
}
-----
I think you asked the same problem here: http://code.google.com/p/flash-selenium/issues/detail?id=34#c1
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 samueladesoga@gmail.com as i think the issue is different from what this topic addresses
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);
browser.start();
flexUITester = new FlexUISelenium(browser, "FlickrRIATest");
browser.open(URL);
}
public void tearDown() {
browser.stop();
}
public void testColorTransition() {
try { Thread.sleep(10000); }
catch (InterruptedException ex) { }
flexUITester.type("Gowri").at("searchTerms");
try { Thread.sleep(10000); }
catch (InterruptedException ex) { }
flexUITester.click("Search");
try { Thread.sleep(10000); }
catch (InterruptedException ex) { }
}
public static Test suite() {
return new TestSuite(FlexSample.class);
}
public static void main(String args[]) {
junit.textui.TestRunner.run(suite());
}
}
Today I'm seeing strange error after using selenium = new DefaultSelenium("localhost", 4444, *firefoxproxy, http://google.com);
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
Thanks,
Vikram
Thanks a lot for the tip! Worked for me.
Thanks buddy !!!! It helped me...
Thanks man!! Your post helped a lot!!
Thanks info in your post helped me a lot... thank you
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 purpose.is there any ebook regarding flash selenium .please let me know.my id is mamta.singla@gmail.com
Thanks so much it really helped me :)
Post a Comment