Re: [webdriver] Flash

1,565 views
Skip to first unread message
Message has been deleted

Jason Huggins

unread,
Aug 4, 2009, 7:29:48 PM8/4/09
to webd...@googlegroups.com
On Tue, Aug 4, 2009 at 10:45 AM, PerfectStorm<john.m...@gmail.com> wrote:
> Has anyone tried to do any testing with Flash? Sorry for so mnay
> questions just trying to get a proposal together on automation tools
> we may use.

I have not, but*, that won't stop me from giving you advice on how to do it. ;-)

There are two approaches, one easy+bad, the other hard+good.

The easy+bad way:
First, you use webdriver to open the browser and load the page that
contains your flash app.
Second, you maximize the browser window so the flash application is in
a precise predictable location on the screen.
Third, you use something like Java's Robot library to send an OS-level
clicking and typing to an absolute screen coordinate that lines up
with the fields and buttons in your flash app.
This is bad approach because testing using absolute screen coordinates
is very, very brittle, but sometimes it's better than nothing. You
might be able to improve this technique by using absolute screen
coordinates *relative* to the top/left corner of the browser window,
whereever it happens to be on the screen. But it's still a risky move.
Test automation depending solely on screen coordinates was how it was
done in the Dark Ages. It is an uncivilized and barbaric practice that
should only be seen in museums.

The hard+good way:
First, you modify the source code of you the flash application,
exposing internal methods using the ActionScript's ExternalInterface
API. Once exposed, these methods will be callable by JavaScript in the
browser.
Second, now that JavaScript can call internal methods in your flash
app, you use WebDriver to make a JavaScript call in the web page,
which will then call into your flash app.
This technique is explained further in the docs of the flash-selenium
project. (http://code.google.com/p/flash-selenium/), but the idea
behind the technique applies just as well to WebDriver.


Basically, there is no free lunch when it comes to testing a flash app
inside the browser. You either have to do it the bad old way using
brittle absolute screen coordinates, or you have to extend/modify your
flash application with custom automation methods. This is not a
possible solution if you don't have full control over the flash app's
source code. But if you do have full control, using the
ExternalInterface API is the preferred way to go.

- Jason Huggins
twitter: @jhuggins

Pushpraj Singh

unread,
Jul 11, 2013, 7:54:29 AM7/11/13
to webd...@googlegroups.com

I think , I have got the right post to get the help.
I have already posted query here but no answer yet and since then I have read many forums and post related to this problem about uploading/browsing file via webdriver
This method sendKeys("absolute path to the file you want to upload via webdriver"); worked for me everywhere but
how to make this work when its a flash button.

You might not want to give answer to my problem because of two reasons:
a) I have already posted it on another forum and asking here too (duplicate)
b) might want to create another post as this post doesn't talk about any one problem but WebDriver Flash
So get to the post (if you insist otherwise I'll be happy if solve the problem), are you talking about using jars available on this page http://code.google.com/p/flash-selenium/downloads/list specifically
flashselenium-java-client-extension-1.0.jar
what are things that I can get out this jar, how to inculde this in my maven project.

Thanks
Reply all
Reply to author
Forward
0 new messages