How to do flash Testing using Selenium WebDriver? Example 1

Please read before this

How to do flash Testing using Selenium WebDriver?

After reading above you know that there is one class which is having capability to automate flash app.

So now we should know following things before start implementation of our example.

1. we can’t access flash objects using Xpath using firebug.

Flash can't access by xpath using firebug










2. To perform action developer should assign appropriate object ID.

Firefox firebug - Get Object ID for permadi - flashjscommand app











3. Developer should expose all flash functions which are used to test flash application.

Sample Flash APP
Play Button
Flash method being used: Play()
Stop Button
Flash method being used: StopPlay()
Rewind Button
Flash method being used: Rewind()
NextFrame Button
Flash method being used: TGetProperty(nameOfTargetMovieClip, propertyIndex) and GotoFrame(frameNum)
Zoomin Button & Zoomout Button
Flash method being used: Zoom(relative percentage)
Send Data
Flash method being used: SetVariable(variableName, variableValue)
Receive Data
Flash method being used: GetVariable(variableName)


4.  how to communicate between Adobe Flash objects and Javascript ?

We have one class which is helpful to call functions of flash by making run-time JavaScript functions – Check out LINK

FlashObjectWebDriver class and constructor mapping with object ID

How call functions works in FlashObjectWebDriver










5. Make one new class named

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class FlashObjectWebDriver {
 private final WebDriver webDriver;
 private final String flashObjectId;

public FlashObjectWebDriver(final WebDriver webDriver, final String flashObjectId) {
 this.webDriver = webDriver;
 this.flashObjectId = flashObjectId;

public String callFlashObject(final String functionName, final String... args) {
 final Object result =
 makeJsFunction(functionName, args),
 new Object[0]);

return result != null ? result.toString() : null;

private String makeJsFunction(final String functionName, final String... args) {
 final StringBuffer functionArgs = new StringBuffer();

if (args.length > 0) {
 for (int i = 0; i < args.length; i++) {
 if (i > 0) {
 functionArgs.append(String.format("'%1$s'", args[i]));
 return String.format(
 "return document.%1$s.%2$s(%3$s);",


6. Now make new class to test our example

import org.openqa.selenium.firefox.FirefoxDriver;

public class permadi_INTERACTION_WITH_JAVASCRIPT {

 public static void main(String[] args) throws InterruptedException {
 FirefoxDriver driver = new FirefoxDriver();

 FlashObjectWebDriver flashApp = new FlashObjectWebDriver(driver, "myFlashMovie");
 flashApp.callFlashObject("Play"); // first number
 flashApp.callFlashObject("StopPlay"); // operation

 flashApp.callFlashObject("SetVariable","/:message","Learn Flash testing with Webdriver");



8. Observe test execution on browser

Please download code from




For a better web


News and reviews from the world of gadgets, gear, apps and the web

Digital Inspiration

Tips and tutorials around all things tech.

Thinkwareglobal's Blog

Just another weblog

Kenazari's Blog

Just another weblog

Richfowler1's Blog

Just another weblog

Romaicus's Blog

Just another weblog


Just another site


Just another site


Just another site


digital media expert blog

Different Journeys

Let's make life easier!

Thinking in Silverlight

Silverlight/WPF/Windows 8 Store App




Promoting Indian language Books

Actively Lazy

Software, crafted with passion


An ongoing discussion about SAP infrastructure

SAP Career

Your Career Mentor


Just another site

The secret product manager

Thoughts about product management, SUSE, Linux, ARM processors, Cloud, AIX, Power Systems, and other things that interest me

Simon Les Flex's Blog

SAP Process Integration Specialist - NOW WE CAN DO BETTER!

Oracle Technologies Primer

An Oracle Fusion Middleware and iPaaS blog!

Gilberto Holms

Java, Middleware, SOA Architecture Blog

The Skeleton

Java code skeletons, tips and pointers

J@n van Zoggel

Journal of a tech junkie

The Pragmatic Integrator

Hints and tips from a pragmatic integration specialist


The pace of life..

Optimalbg's Blog

Just another site

IT Jobs in USA

Keep the track of this Blog if you are looking out for some good Opportunities to work in USA....

Referral Jobs | Right Place to Get a Job

Hurry you are one Click away to get a job - Fresher Jobs for 2012, 2013 fresher’s and also high paid jobs for well Experienced IT professionals on Referal jobs.

Michael Korn's Blog

Musings on Life, Career, Faith and Technology


Just another weblog


.Net Core, AspNetCore, Entity Framework, Entity Framework Core, AspNetIdentity, AspNetIdentityCore, Unit Test, WCF, Workflows

Expertqtp's Weblog

Just another weblog

Sai Chamarthi

Experienced Testing Professional


A great site

Suresh4qtp's Blog

Just another site


This site is the cat’s pajamas

It's always something...

Just another weblog

Faculty of Information Technology - Lê Ngọc Tiến

Be Yourself! Simplify Our Goals! Nothing is Impossible!

Anti-Malware Testing

Thoughts on security product testing past and present

Methods & Tools

Practical knowledge for the software developer, tester and project manager

Mindscripts Software Testing Training Institutes In Pune

Software Testing In Pune, Software Testing Training In Pune, Software Testing Training Institute,Software Testing Training Institutes In Pune ,Software Testing Training Centers,Software Testing Classes In Pune,,Software Testing Courses Pune, Software Testing Certification In Pune,,software testing certification course in pune,software testing certification institutes in pune

edington associates

Working with organizations to develop sustainable and thriving workplaces and people.

Enterprise WordPress hosting, support, and consulting - WordPress VIP

Our best-in-class enterprise WordPress hosting platform, expert consulting and support, and diverse partner ecosystem free you to focus on your business objectives.

WORK Online

Virtual Office at HOME