leeleoo / flash-selenium

Automatically exported from code.google.com/p/flash-selenium
0 stars 0 forks source link

Is it Bug: Creating flashApp with id="clickcolors" doesnt work but instead with name="coloredSquare" it works. #14

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago

What steps will reproduce the problem?
Original sample selenium code available here fails to execute flashApp. Its
created using this statement:
flashApp = new FlashSelenium(selenium, "clickcolors"); 
"clickcolors" is the id of object in colors.html

What is the expected output? What do you see instead?
But if I create flashApp instance using name of embed object in colors.html
page, it works. 
flashApp = new FlashSelenium(selenium, "coloredSquare");

Please let me know if I am not doing it correctly, or I missed out anything. 

Original issue reported on code.google.com by manisha....@gmail.com on 4 May 2009 at 6:11

GoogleCodeExporter commented 8 years ago
Hi Manisha,

You should be using "new FlashSelenium(selenium, "coloredSquare");"
if you're testing the sample colors application.

Our bad that only the java client test cases were updated and not others. 
Thanks for
bringing this up.

Original comment by sachin.s...@gmail.com on 16 May 2009 at 5:15

GoogleCodeExporter commented 8 years ago
I tried using IE6 + Win XP using "clickcolors" but the test 
"testColorTransition"
doesn't work completely
line 36:                 assertEquals(BLUE, flashApp.call("getColor")); => it 
seems
that the previous click doesn't work on IE

Another thing... If I use 'coloredSquare' on IE6 an exception is thrown:
"com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: Element
coloredSquare not found"

Original comment by s0c...@gmail.com on 30 May 2009 at 2:23

GoogleCodeExporter commented 8 years ago
I am trying to test a Flash App using FlashSelenium.
In my case, I get hold of the flash object name as below.

browser.getEval("this.browserbot." +
                    "getCurrentWindow().document.getElementsByTagName('frame')[0]" +
                    ".contentWindow.document.getElementsByTagName('frame')[0]." +
                    "contentWindow.document.getElementById('player')." +
                    "getElementsByTagName('param')[0].name");

The HTML code snippet is something like this.

<object id="player" ...>
<param value="player/playershell.swf" name="movie"/>
...
</object>

But I get exception when tried to test any flash menthods.
FlashSelenium flashApp = new FlashSelenium(browser, 
browser.getEval("this.browserbot." +
                    "getCurrentWindow().document.getElementsByTagName('frame')[0]" +
                    ".contentWindow.document.getElementsByTagName('frame')[0]." +
                    "contentWindow.document.getElementById('player')." +
                    "getElementsByTagName('param')[0].name"));
        System.out.println ("Is Playing: "+flashApp.IsPlaying());

ERROR: Threw an exception: Element movie not found.

I also tried by using the object id as parameter to FlashSelenium constructor.

I tried with both original JAR file of flash-selenium and the JAR with some
fixes(found in this forum).

Appreciate any help in resolving this.

NOTE: I used Selenium RC 1.0 beta2. Wanted to know if this is something related 
to
the issues for supporting RC 1.0 version as mentioned in the flash-selenium web 
page.

Thanks,
Rajesh

Original comment by rkmohapa...@gmail.com on 5 Jun 2009 at 5:49

GoogleCodeExporter commented 8 years ago
Tried again with the fixed flash-selenium.jar posted in this forum.
With the followng code I did not get any exception. 
But I am little confused with the return values of the method calls to 
IsPlaying and
PercentLoaded.

The flash movie is actually playing a powerpoint presentation within flash.
And the call to IsPlaying return false and call to PercentLoaded returns 100 
although
all the slides in the presentation are not yet played.

Any idea what could be the reason for this?

FlashSelenium flashApp = new FlashSelenium(browser, 
browser.getEval("this.browserbot." +
                    "getCurrentWindow().document.getElementsByTagName('frame')[0]" +
                    ".contentWindow.document.getElementsByTagName('frame')[0]." +
                    "contentWindow.document.getElementById('player').id"));
System.out.println ("Is Playing: "+flashApp.IsPlaying());
System.out.println ("Loaded: "+flashApp.PercentLoaded());

Appreciate any help with this.

Thanks,
Rajesh

Original comment by rkmohapa...@gmail.com on 5 Jun 2009 at 6:17

GoogleCodeExporter commented 8 years ago
You might try changing html src code as shown here.
http://code.google.com/p/flash-selenium/source/browse/trunk/flash/changingcolors
/colors.html
There is an <embed> tag here. It takes up "name" attribute for this tag. Your 
html
src code doesn't have this. 

Other thing is I am not sure what is browser type in ur code. I have something 
like
this: 
   28:     selenium = SeleniumEnvironment.create("http://url-to-open", this)
   29:                  .createSelenium();
   30:     selenium.start();
   31:     flashApp = new FlashSelenium(selenium, SWF_NAME);
   32:     selenium.open(URL);
             ....
   38:     flashApp.StopPlay();
   39:     assertEquals(100, flashApp.PercentLoaded());
   40:   }

Hope this helps. 
Manisha

Original comment by manisha....@gmail.com on 5 Jun 2009 at 6:31

GoogleCodeExporter commented 8 years ago
Hi! I tried to access the interface of the Colored Square flash sample using the
FlashSelenium.dll library, and not the jar archive. So far I have not succeeded 
yet
in this task.
This is the code I use:

private FlashSelenium.FlashSelenium fs;
private ISelenium selenium;
public void SetupTest()
{           
   selenium = new DefaultSelenium("localhost", 4444, "*firefox",
"http://www.google.com/");
   selenium.Start();
   fs = new FlashSelenium.FlashSelenium(selenium,"coloredSquare");
   selenium.Open("http://flashselenium.t35.com/colors.html");
}
public void TheFlashTest()
{                                   
   fs.Call("click");
   System.Threading.Thread.Sleep(10000);
}

When I run this code, I get an error message:
ERROR: Threw an exception: NPMethod called on non-NPObject wrapped JSObject!

Can you please point me where the problem is?

Original comment by artur.i...@gmail.com on 26 Feb 2010 at 11:57