Overview of Flash application
If you are looking for web application automation testing probably “Selenium” is one of the best open source tool available to perform the automation. But sometimes we may need to do some work around or alternative solutions to when using selenium to test the flash components in the application.
Requirements specify to use flash or flex to be used to make the web site look better, but it will be a challenging task for automation engineer because selenium doesn’t support to read or interact or perform actions on flash objects.
Flash is a multimedia software for creating graphical applications like animated images, video players, and audio players in a webpage.
Flash applications are embedded into HTML code using <object> and <embed>, flash functional methods are not displayed in HTML code .It uses JavaScript internally to call flash methods.
Flash application testing
Flash feature testing is a kind of white-box testing, flash methods are not exposed in HTML page. So, it’s difficult for automation tester to identify elements to perform actions.
Sample flash application in http://www.permadi.com/tutorial/flashjscommand
Flash application can be tested in two ways:
If the developers can provide recompiled application or software by adding some flash methods. Then below example shows the sample application complied with the flash methods
Step 1:
Create FlashWebDriver class which receives flash and perform user actions on flash application using JavaScript internally.
package com.java.selenium;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class FlashWebDriver
{
private final WebDriver webdriver;
private final String flashObjectId ;
public FlashWebDriver(final WebDriver webdriver,final String flashObjectId)
{
this.webdriver=webdriver;
this.flashObjectId=flashObjectId;
}
public String click(final String objectId,final String buttonLabel)
{
return callFlashObject("DoFlashClick",objectId,buttonLabel);
}
public String click(final String objectId)
{
return callFlashObject(objectId,"");
}
public String callFlashObject(final String functionName,final String... args)
{
final Object result=((JavascriptExecutor) webdriver).executeScript
(makeJsFuntion(functionName,args), new Object[0]);
return result!=null ? result.toString() :null;
}
private String makeJsFuntion(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(",");
}
functionArgs.append(String.format("'%1$s'", args[i]));
}
}
return String.format("return document.%1$s.%2$s(%3$s);", flashObjectId, functionName,functionArgs);
}
}
Step 2:
Write the automation script for testing flash application using FlashWebDriver.
package com.java.selenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Flash_Example
{
public static void main(String[] args) throws Throwable
{
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
FlashWebDriver flashapp=new FlashWebDriver(driver,"myFlashMovie");
driver.get("http://www.permadi.com/tutorial/flashjscommand/");
flashapp.callFlashObject("Play");
Thread.sleep(3000);
flashapp.callFlashObject("StopPlay");
}
}
Windows controls in Web Applications
Web applications testing sometimes involves uploading & downloading of varies types of documents like .txt, .doc, .docx. Windows popup appears, when user click on upload or download button on web application.
Functional testing tool like selenium doesn’t handle windows based popups while uploading & downloading documents. So, automation tester can chose “Auto IT” in order to handle windows based popups.
Auto IT
Steps to handle window based applications using Auto IT.
Application URL : http://www.pdfonline.com/convert-pdf/
Step: 1
Write Auto IT script in Auto IT Script Editor by mentioning details regarding window popup and data.
WinWaitActive("File Upload")
WinActivate("File Upload")
Local $file="C:\"&$CmdLine[1]
WinActivate("File Upload")
ControlSetText("File Upload","","Edit1",$file)
ControlClick("File Upload","","Button1")
Step: 2
Compile the Auto IT script file which is .au3 file, then .exe Auto IT file would be generated.
Step: 3
Now let’s invoke the autoit exe file from the standalone or our selenium code which to handle windows based applications or the popups.
package com.java.selenium;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Fileupload_Windows
{
public static void main(String[] args) throws Throwable
{
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("http://www.pdfonline.com/convert-pdf");
WebElement k=driver.findElement(By.cssSelector("input[name*='Filedata']"));
((JavascriptExecutor)driver).executeScript("arguments[0].click();", k);
String[] command=new String[]{"C:/ FileUpload.exe","AutoTest_WordDoc.docx"};
Runtime.getRuntime().exec(command);
}
}
If you are looking for web application automation testing probably “Selenium” is one of the best open source tool available to perform the automation. But sometimes we may need to do some work around or alternative solutions to when using selenium to test the flash components in the application.
Requirements specify to use flash or flex to be used to make the web site look better, but it will be a challenging task for automation engineer because selenium doesn’t support to read or interact or perform actions on flash objects.
Flash is a multimedia software for creating graphical applications like animated images, video players, and audio players in a webpage.
Flash applications are embedded into HTML code using <object> and <embed>, flash functional methods are not displayed in HTML code .It uses JavaScript internally to call flash methods.
Flash application testing
Flash feature testing is a kind of white-box testing, flash methods are not exposed in HTML page. So, it’s difficult for automation tester to identify elements to perform actions.
Sample flash application in http://www.permadi.com/tutorial/flashjscommand
Flash application can be tested in two ways:
- Developer has to provide flash methods for testing, then we can perform testing by passing them through JavaScript code.
- Independent testers doesn’t have access to source code, can use image based tool called Sikuli, which uses images to perform user actions.
If the developers can provide recompiled application or software by adding some flash methods. Then below example shows the sample application complied with the flash methods
Step 1:
Create FlashWebDriver class which receives flash and perform user actions on flash application using JavaScript internally.
package com.java.selenium;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
public class FlashWebDriver
{
private final WebDriver webdriver;
private final String flashObjectId ;
public FlashWebDriver(final WebDriver webdriver,final String flashObjectId)
{
this.webdriver=webdriver;
this.flashObjectId=flashObjectId;
}
public String click(final String objectId,final String buttonLabel)
{
return callFlashObject("DoFlashClick",objectId,buttonLabel);
}
public String click(final String objectId)
{
return callFlashObject(objectId,"");
}
public String callFlashObject(final String functionName,final String... args)
{
final Object result=((JavascriptExecutor) webdriver).executeScript
(makeJsFuntion(functionName,args), new Object[0]);
return result!=null ? result.toString() :null;
}
private String makeJsFuntion(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(",");
}
functionArgs.append(String.format("'%1$s'", args[i]));
}
}
return String.format("return document.%1$s.%2$s(%3$s);", flashObjectId, functionName,functionArgs);
}
}
Step 2:
Write the automation script for testing flash application using FlashWebDriver.
package com.java.selenium;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Flash_Example
{
public static void main(String[] args) throws Throwable
{
WebDriver driver=new FirefoxDriver();
driver.manage().window().maximize();
FlashWebDriver flashapp=new FlashWebDriver(driver,"myFlashMovie");
driver.get("http://www.permadi.com/tutorial/flashjscommand/");
flashapp.callFlashObject("Play");
Thread.sleep(3000);
flashapp.callFlashObject("StopPlay");
}
}
Windows controls in Web Applications
Web applications testing sometimes involves uploading & downloading of varies types of documents like .txt, .doc, .docx. Windows popup appears, when user click on upload or download button on web application.
Functional testing tool like selenium doesn’t handle windows based popups while uploading & downloading documents. So, automation tester can chose “Auto IT” in order to handle windows based popups.
Auto IT
Steps to handle window based applications using Auto IT.
Application URL : http://www.pdfonline.com/convert-pdf/
Step: 1
Write Auto IT script in Auto IT Script Editor by mentioning details regarding window popup and data.
WinWaitActive("File Upload")
WinActivate("File Upload")
Local $file="C:\"&$CmdLine[1]
WinActivate("File Upload")
ControlSetText("File Upload","","Edit1",$file)
ControlClick("File Upload","","Button1")
Step: 2
Compile the Auto IT script file which is .au3 file, then .exe Auto IT file would be generated.
Step: 3
Now let’s invoke the autoit exe file from the standalone or our selenium code which to handle windows based applications or the popups.
package com.java.selenium;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Fileupload_Windows
{
public static void main(String[] args) throws Throwable
{
WebDriver driver=new FirefoxDriver();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
driver.manage().window().maximize();
driver.get("http://www.pdfonline.com/convert-pdf");
WebElement k=driver.findElement(By.cssSelector("input[name*='Filedata']"));
((JavascriptExecutor)driver).executeScript("arguments[0].click();", k);
String[] command=new String[]{"C:/ FileUpload.exe","AutoTest_WordDoc.docx"};
Runtime.getRuntime().exec(command);
}
}
The blog gaveidea to automate flash and windows control using selenium
ReplyDeleteMy sincere thanks for sharing thos post
Selenium Training in Chennai
really you have been shared informative blog. it will be really helpful to many peoples. so keep on sharing such kind of an interesting blogs.
ReplyDeleteselenium training in chennai
It was very nice blog to learn about Selenium.Thanks for sharing new things. You are doing a great job. You inspire me to write for other. Thank you very much. Selenium Training in Chennai | Software Testing Training in Chennai
ReplyDeleteThanks for sharing great information in your blog. Got to learn new things from your Blog . It was very nice blog to learn about Selenium.
ReplyDeleteSoftware Testing Training in Bangalore
Software Testing Training in BTM Layout
Software Testing Training in Marathahalli
Nice blog has been shared by you. it will be really helpful to many peoples who are all working under the technology.thank you for sharing this blog.
ReplyDeleteSoftware Testing Training in Marathahalli|
Software Testing Training in Bangalore|
I have read your blog and I gathered some needful information from your blog. Keep update your blog. Awaiting for your next update.
ReplyDeleteSoftware Testing Training in Marathahalli|
Software Testing Training in Bangalore|
A very interesting case study
ReplyDeleteMainframe Training In Chennai | Hadoop Training In Chennai | ETL Testing Training In Chennai
This concept is a good way to enhance the knowledge.thanks for sharing. please keep it up selenium Online Training Bangalore
ReplyDelete3D Animation Training in Noida
ReplyDeleteBest institute for 3d Animation and Multimedia
Best institute for 3d Animation Course training Classes in Noida- webtrackker Is providing the 3d Animation and Multimedia training in noida with 100% placement supports. for more call - 8802820025.
3D Animation Training in Noida
Company Address:
Webtrackker Technology
C- 67, Sector- 63, Noida
Phone: 01204330760, 8802820025
Email: info@webtrackker.com
Website: http://webtrackker.com/Best-institute-3dAnimation-Multimedia-Course-training-Classes-in-Noida.php
This is very helpful post.
ReplyDeleteInviul
Selenium Tutorials
Avinash Mishra
Thanks For Sharing The Information The information Shared Is Very valuable Please keep updating us Time Just Went On reading The article Python Online Course AWS Online Course Devops Online Course DataScience Online Course
ReplyDeleteAnd indeed, I’m just always astounded concerning the remarkable things served by you. Some four facts on this page are undeniably the most effective I’ve had.
ReplyDeleteData science Course Training in Chennai | Data Science Training in Chennai
RPA Course Training in Chennai | RPA Training in Chennai
AWS Course Training in Chennai | AWS Training in Chennai
Devops Course Training in Chennai | Devops Training in Chennai
Selenium Course Training in Chennai | Best Selenium Training in Chennai
Java Course Training in Chennai | Best Java Training in Chennai
Hey, would you mind if I share your blog with my twitter group? There’s a lot of folks that I think would enjoy your content. Please let me know. Thank you.
ReplyDeleteJava Training in Chennai | J2EE Training in Chennai | Advanced Java Training in Chennai | Core Java Training in Chennai | Java Training institute in Chennai
I am really thankful for posting such useful information. It really made me understand lot of important concepts in the topic. Keep up the good work!
ReplyDeleteOracle Training in Chennai | Oracle Course in Chennai
Thanks for sharing great info with us.
ReplyDeleteI wanted to write a little comment to support you and wish you a good continuation All the best for all your blogging efforts.Your good knowledge and kindness in playing with all the pieces were very useful.
Python classes in Pune
ReplyDeleteIt was really a wonderful article and I was really impressed by reading this blog. We are giving all software Courses such as Data science, big data, hadoop, R programming, python and many other course. big data training in bangalore is one of the reputed training institute in bangalore. They give professional and real time training for all students.
thank you for giving this post..
ReplyDeletedenmark web hosting
inplant training in chennai
ReplyDeleteGreat post.I really liked you article,your writing style is simply awesome with useful information. Best python certification course in Bangalore is offering Python training with 100% Placement assistance.Get certification under certified experts
Such a very well and helpful post..
ReplyDeleteThanks for sharing with us,
We are again come on your website,
Thanks and good day,
Please visit our site,
buylogo
Usually I never comment on blogs but your article is so convincing that I never stop myself to say something about it. You’re doing a great job,Keep it up.
ReplyDeleteTry Our Evil Spirit Removal Expert In Toronto Services and Get All the benefits of it in your life, we make All your Personal problems solved in just minutes.
Great info! I recently came across your blog and have been reading along. I thought This is an awesome post.Thanks for this blog,
ReplyDeleteOracle Training in Chennai | Certification | Online Training Course | Oracle Training in Bangalore | Certification | Online Training Course | Oracle Training in Hyderabad | Certification | Online Training Course | Oracle Training in Online | Oracle Certification Online Training Course | Hadoop Training in Chennai | Certification | Big Data Online Training Course
Good job in presenting the correct content with the clear explanation. The content looks real with valid information. Good Work
ReplyDeletePython Training in Chennai
Python Training in Velachery
Python Training in Tambaram
Python Training in Porur
Python Training in Omr
Python Training in Annanagar
This comment has been removed by the author.
ReplyDeleteI like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite sure I will learn much new stuff right here! Good luck for the next!Software Testing Training in Chennai
ReplyDeleteSoftware Testing Training in Velachery
Software Testing Training in Tambaram
Software Testing Training in Porur
Software Testing Training in Omr
Software Testing Training in Annanagar
Thankyou for the amazing blog about automating flash. A very useful content indeed.
ReplyDeletedata science training in chennai
ccna training in chennai
iot training in chennai
cyber security training in chennai
ethical hacking training in chennai
DevOps is currently a popular model currently organizations all over the world moving towards to it. Your post gave a clear idea about knowing the DevOps model and its importance.
ReplyDeleteGood to learn about DevOps at this time.
DevOps Training in Chennai
DevOps Course in Chennai
Communication is a two way process. If done properly, it gives excellent result. Thus opting for the best Integrated Marketing Communication Course on Talentedge is wise. To know more visit:
ReplyDeleteThanks for sharing useful information.
ReplyDeletechat with astrologer online
onlie chat with astrologer
astro talk
astro chat
astrochat
talk to astrolgoer online
talk to astrologer
Glad to visit this blog, really helpful. Gathered lots of information and waiting to see more updates.
ReplyDeleteRPA Training in Chennai
RPA Training Online
RPA Course in Coimbatore
"Many regards to the blogger! I found your posts to be very helpful. They gave me a lot of inspiration and knowledge. Thank you for the helpful details. Continue your wonderful effort! eager to read more from you in the future."
ReplyDeleteRegards,
Software Testing Course