SlideShare a Scribd company logo
Efficient Automated Test
Creation With Selenium IDE
           Plugins

  Selenium Conference 2011
        San Francisco
         4th April 2011
Samit Badle

           @samitbadle

http://blog.reallysimplethoughts.com
Goals

• Give you a taste of creating a Selenium
  IDE plugin
• Make you aware of the code in various
  files by completing the TODOs in the
  exercises
• Introduce you to ideas for efficiently
  creating tests or test data
Agenda

• Brief introduction
• Create a Selenium IDE plugin with
  – Menu and Toolbar buttons
  – Selenium IDE Plugin API
  – Preferences
  – Command Builder
• Ideas to efficiently create tests
Getting Ready

• Install the latest version of Firefox
  – Either Firefox 3.6.16 or Firefox 4.0
• Install 7-Zip or your favorite zip tool
• Download the WorkshopFiles.zip
  – http://links.reallysimplethoughts.com/files/Wor
    kshopFiles.zip
Using WorkshopFiles.zip

• Extract WorkshopFiles.zip
• Install the special version of Selenium IDE
  (selenium-ide-multi-workshop.xpi) included
  in it
• The HandsOn folder contains the
  exercises
• The Solutions folder contains the
  completed versions and pre-built plugins
What are Selenium IDE Plugins?




           Demos!
Where to find them?

• Selenium download page
  http://seleniumhq.org/download/


• Firefox add-ons page
  https://addons.mozilla.org/en-US/firefox/


• Other places on the Internet
  Google ☺
http://seleniumhq.org/download/
https://addons.mozilla.org/
Efficient Automated Test Creation?


         “Automated Tests are Cool!”

 “Automating Generation of Automated Tests is
                Even Cooler.”

                 “But How?”
“Be Efficient” Selenium IDE Plugin


                Here’s How!

• Add “Write My Test” to the context menu
• When I click on it, write my test for me
“Be Efficient” Selenium IDE Plugin


               The Benefits

• Capture test data or test commands
  directly
• Direct access to the web page
• Reuse code from Selenium IDE and
  Selenium
Demo!
Be Efficient In Action
•   Open Selenium IDE
•   In Firefox, open www.bing.com
•   Type selenium in search box
•   Hit the enter key
•   Right click on the results web page
•   Select Write My Test!
•   Check the generated test case
•   Execute the test case (maybe with
    highlight elements plugin)
Be Efficient In Action
Be Efficient In Action
Be Efficient In Action
Be Efficient In Action
Be Efficient In Action
Be Efficient Code

      Main code


      Installation / registration code



      User interface



      User interface styling


      Preferences defaults

      Files required for a Firefox add-on
Simple Firefox Add-on
Simple Firefox Add-on

• XPI (zippy)
• Install Manifest (install.rdf)
• Chrome Manifest (chrome.manifest)
• Overlay containing a menu and toolbar
  button
• Style-sheet for the toolbar button
• Icon for the toolbar button
Simple Firefox Addon
Your Turn

• Explore the files in the first exercise
  HandsOn/selenium-ide_be-efficient_ex1
• Complete the TODO in the following files
  – Install Manifest (install.rdf)
  – Chrome Manifest (chrome.manifest)
  – Overlay (ovIDE.xul)
  – Style sheet (beefficient.css)
Package and Install

•   Create a zip of all files in src folder
•   Change the file extension from .zip to .xpi
•   Open this xpi file in Firefox
•   Click on install button
•   Restart to complete
Result
Result

• New menu item in the Options menu in
  Selenium IDE
• A new toolbar button on the right side
• Clicking on the menu item or toolbar item
  results in a simple alert message
Selenium IDE Plugin API
Plugin API Functions

•   addPlugin
•   addPluginProvidedIdeExtension
•   addPluginProvidedFormatter
•   addPluginProvidedUserExtension
Using the Plugin API

• Code to register plugin with Selenium IDE
• Load the real plugin code as an IDE
  extension
• Lots of boilerplate code
Using My pluginframework.js

Lots of boilerplate code hidden away in
  pluginframework.js and reduces the
        required code to two lines.
Plugin API
Your Turn

• Explore the files in the second exercise
  HandsOn/selenium-ide_be-efficient_ex2
• Complete the TODO in the following files
  – Chrome Manifest (chrome.manifest)
  – Setup overlay (setup.xul)
  – Setup code (setup.js)
  – Overlay (ovIDE.xul)
  – Real plugin code (BeEfficient.js)
Result

• Be Efficient Plugin now shows up in
  Plugins tab of the Selenium IDE options
  dialog
• The plugin code in BeEfficient and
  ovIDE.xul can now change the enabled
  state from the UI
Result
Preferences
Preferences

• Lot of support is built into Firefox
• Involves mostly boilerplate code
Preferences
• Create defaults for the preferences
• Create dialog to allow user to change preference
• Create an observer to receive notification of
  changes

• And one of the following (or both):
  – Define options in Install manifest
  – Create UI (usually menu) to show Options dialog
Preferences
Your Turn

• Explore the files in the third exercise
  HandsOn/selenium-ide_be-efficient_ex3
• Complete the TODO in the following files
  – Preference defaults (defaults.js)
  – Options dialog (options.xul)
  – Plugin code (BeEfficient.js)
  – Install Manifest (install.rdf)
Result

• Be Efficient Plugin options dialog is
  available
• The options dialog can now be opened
  from the menu item
• The preference can be seen in
  about:config
• The preference and the UI elements are
  now in sync
Result
Result
Creating a Command Builder
Command Builder

• Puts a menu item in the context menu on
  the web page when Selenium IDE is open
• Three types: Action, Accessor, Util
• Util type will be available with Selenium
  IDE v1.0.11
Util Command Builder
• Register the Util command builder
  functions

• Prepare (builder) function
  – Returns the menu item to show
• Execute function
  – Called when the menu item is clicked
  – Can return zero or more commands to add to
    the test case
Be Efficient Command Builder

• When the Write My Test! context menu
  item is pressed, create commands for the
  following
• Verify page title
• Wait for all results
• Verify each result
Your Turn

• Explore the files in the third exercise
  HandsOn/selenium-ide_be-efficient_ex4
• Complete the TODO in the following file
  – Plugin code (BeEfficient.js)
Result

• Write My Test! context menu is available
  on the web page when Selenium IDE is
  open
• Clicking on the write my test on bing.com
  search results page will generate your test
Be Efficient In Action
•   Open Selenium IDE
•   In Firefox, open www.bing.com
•   Type selenium in search box
•   Hit the enter key
•   Right click on the results web page
•   Select Write My Test!
•   Check the generated test case
•   Execute the test case (maybe with
    highlight elements plugin)
Resources for Selenium IDE Plugins

• Selenium IDE Plugin Documentation
  http://seleniumhq.org/projects/ide/plugins.html


• My Blog
  http://blog.reallysimplethoughts.com/
Resources for Firefox Add-ons
https://developer.mozilla.org/en/XUL_School

https://developer.mozilla.org/en/Building_an_Extension

https://developer.mozilla.org/En/Firefox_addons_developer_guide

http://robertnyman.com/2009/01/24/how-to-develop-a-firefox-extension/

http://books.mozdev.org/chapters/index.html

https://developer.mozilla.org/en/Creating_XPCOM_Components

http://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/

http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/
Time to Celebrate!

 Thanks for Joining!
Questions?

Feel free to chat with me anytime
Ad

Recommended

From IDE to Selenium 2
From IDE to Selenium 2
davehunt82
 
Selenium (1)
Selenium (1)
onlinemindq
 
Basics of Selenium IDE,Core, Remote Control
Basics of Selenium IDE,Core, Remote Control
usha kannappan
 
Selenium webdriver course content rakesh hansalia
Selenium webdriver course content rakesh hansalia
Rakesh Hansalia
 
Selenium topic 3 -Web Driver Basics
Selenium topic 3 -Web Driver Basics
ITProfessional Academy
 
An Overview of Selenium
An Overview of Selenium
adamcarmi
 
Selenium IDE Introduction, Installation and Working
Selenium IDE Introduction, Installation and Working
Disha Srivastava
 
Selenium
Selenium
Batch2016
 
Selenium IDE
Selenium IDE
b4usolution .
 
Selenium ppt
Selenium ppt
Naga Dinesh
 
Selenium IDE features
Selenium IDE features
onewomanmore witl
 
Selenium Primer
Selenium Primer
gueste1e4db
 
Selenium Demo
Selenium Demo
ankitslide
 
Selenium test automation
Selenium test automation
Srikanth Vuriti
 
Introduction to selenium
Introduction to selenium
Archana Krushnan
 
Web application testing with Selenium
Web application testing with Selenium
Kerry Buckley
 
Automation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Simplilearn
 
Selenium- A Software Testing Tool
Selenium- A Software Testing Tool
Zeba Tahseen
 
Automated Web Testing Using Selenium
Automated Web Testing Using Selenium
Weifeng Zhang
 
Selenium WebDriver with C#
Selenium WebDriver with C#
srivinayak
 
Selenium IDE
Selenium IDE
brendon_jag
 
QSpiders - Automation using Selenium
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
Automation - web testing with selenium
Automation - web testing with selenium
Tzirla Rozental
 
Selenium ppt
Selenium ppt
Aneesh Rangarajan
 
Selenium IDE and Beyond
Selenium IDE and Beyond
Samit Badle
 
Selenium Ide Tutorial
Selenium Ide Tutorial
metapix
 
Selenium Automation
Selenium Automation
Anuradha Malalasena
 
Selenium Ide Tutorials
Selenium Ide Tutorials
gueste1e4db
 
Selenium Training
Selenium Training
Colombo Selenium Meetup
 

More Related Content

What's hot (20)

Selenium IDE
Selenium IDE
b4usolution .
 
Selenium ppt
Selenium ppt
Naga Dinesh
 
Selenium IDE features
Selenium IDE features
onewomanmore witl
 
Selenium Primer
Selenium Primer
gueste1e4db
 
Selenium Demo
Selenium Demo
ankitslide
 
Selenium test automation
Selenium test automation
Srikanth Vuriti
 
Introduction to selenium
Introduction to selenium
Archana Krushnan
 
Web application testing with Selenium
Web application testing with Selenium
Kerry Buckley
 
Automation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Simplilearn
 
Selenium- A Software Testing Tool
Selenium- A Software Testing Tool
Zeba Tahseen
 
Automated Web Testing Using Selenium
Automated Web Testing Using Selenium
Weifeng Zhang
 
Selenium WebDriver with C#
Selenium WebDriver with C#
srivinayak
 
Selenium IDE
Selenium IDE
brendon_jag
 
QSpiders - Automation using Selenium
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
Automation - web testing with selenium
Automation - web testing with selenium
Tzirla Rozental
 
Selenium ppt
Selenium ppt
Aneesh Rangarajan
 
Selenium IDE and Beyond
Selenium IDE and Beyond
Samit Badle
 
Selenium Ide Tutorial
Selenium Ide Tutorial
metapix
 
Selenium Automation
Selenium Automation
Anuradha Malalasena
 
Selenium test automation
Selenium test automation
Srikanth Vuriti
 
Web application testing with Selenium
Web application testing with Selenium
Kerry Buckley
 
Automation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Selenium IDE Tutorial For Beginners | Selenium IDE Tutorial | What Is Seleniu...
Simplilearn
 
Selenium- A Software Testing Tool
Selenium- A Software Testing Tool
Zeba Tahseen
 
Automated Web Testing Using Selenium
Automated Web Testing Using Selenium
Weifeng Zhang
 
Selenium WebDriver with C#
Selenium WebDriver with C#
srivinayak
 
Automation - web testing with selenium
Automation - web testing with selenium
Tzirla Rozental
 
Selenium IDE and Beyond
Selenium IDE and Beyond
Samit Badle
 
Selenium Ide Tutorial
Selenium Ide Tutorial
metapix
 

Viewers also liked (14)

Selenium Ide Tutorials
Selenium Ide Tutorials
gueste1e4db
 
Selenium Training
Selenium Training
Colombo Selenium Meetup
 
Selenium
Selenium
shrialinda
 
Steps to write Selenium
Steps to write Selenium
Rohit Thakur
 
Automated User Tests with Apache Flex
Automated User Tests with Apache Flex
Gert Poppe
 
Selenium IDE and Extensions
Selenium IDE and Extensions
Yana Altunyan
 
Sakai10 Selenium Workshop
Sakai10 Selenium Workshop
coreyjack
 
Selenium IDE
Selenium IDE
Davi Matos
 
Selenium
Selenium
BugRaptors
 
Selenium WebDriver FAQ's
Selenium WebDriver FAQ's
Praveen Gorantla
 
Jmeter Performance Testing
Jmeter Performance Testing
Atul Pant
 
Java Basics for selenium
Java Basics for selenium
apoorvams
 
Selenium ppt
Selenium ppt
Pavan Kumar
 
Selenium ide
Selenium ide
Pé Vịt
 
Selenium Ide Tutorials
Selenium Ide Tutorials
gueste1e4db
 
Steps to write Selenium
Steps to write Selenium
Rohit Thakur
 
Automated User Tests with Apache Flex
Automated User Tests with Apache Flex
Gert Poppe
 
Selenium IDE and Extensions
Selenium IDE and Extensions
Yana Altunyan
 
Sakai10 Selenium Workshop
Sakai10 Selenium Workshop
coreyjack
 
Jmeter Performance Testing
Jmeter Performance Testing
Atul Pant
 
Java Basics for selenium
Java Basics for selenium
apoorvams
 
Selenium ide
Selenium ide
Pé Vịt
 
Ad

Similar to Efficient Automated Test Creation With Selenium IDE Plugins (20)

Selenium tutorial
Selenium tutorial
Mayank Pande
 
Selenium training
Selenium training
Robin0590
 
Selenium Handbook
Selenium Handbook
Suresh Thammishetty
 
Selenium By Pravin Mishra
Selenium By Pravin Mishra
Pravin Mishra
 
Selenium ide made easy
Selenium ide made easy
Narayanan Palani
 
Selenium
Selenium
Daksh Sharma
 
Selenium
Selenium
Anil Babu
 
Sel
Sel
Sandeep A R
 
Selenium ide workshop
Selenium ide workshop
Mohamed Fulail
 
Selenium Installation
Selenium Installation
ANKUR-BA
 
Selenium - Installation
Selenium - Installation
Rajesh-QA
 
Selenium web driver
Selenium web driver
Roman Savitskiy
 
Selenium IDE
Selenium IDE
jaguardesignstudio
 
Selenium Tutorial
Selenium Tutorial
prad_123
 
Learning selenium sample
Learning selenium sample
Minnu Jayaprakash
 
Selenium Introduction
Selenium Introduction
Mayur Khairnar
 
Selenium
Selenium
nil65
 
Selenium ide1
Selenium ide1
mindqqa
 
Selenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Automation Testing
Automation Testing
AbdulImrankhan7
 
Ad

Recently uploaded (20)

10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
10 Key Challenges for AI within the EU Data Protection Framework.pdf
10 Key Challenges for AI within the EU Data Protection Framework.pdf
Priyanka Aash
 
The Future of Technology: 2025-2125 by Saikat Basu.pdf
The Future of Technology: 2025-2125 by Saikat Basu.pdf
Saikat Basu
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
OWASP Barcelona 2025 Threat Model Library
OWASP Barcelona 2025 Threat Model Library
PetraVukmirovic
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Securing AI - There Is No Try, Only Do!.pdf
Securing AI - There Is No Try, Only Do!.pdf
Priyanka Aash
 
AI vs Human Writing: Can You Tell the Difference?
AI vs Human Writing: Can You Tell the Difference?
Shashi Sathyanarayana, Ph.D
 
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik - Passionate Tech Enthusiast
Raman Bhaumik
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
"How to survive Black Friday: preparing e-commerce for a peak season", Yurii ...
Fwdays
 
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
GenAI Opportunities and Challenges - Where 370 Enterprises Are Focusing Now.pdf
Priyanka Aash
 
Curietech AI in action - Accelerate MuleSoft development
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Wenn alles versagt - IBM Tape schützt, was zählt! Und besonders mit dem neust...
Josef Weingand
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Security Tips for Enterprise Azure Solutions
Security Tips for Enterprise Azure Solutions
Michele Leroux Bustamante
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 

Efficient Automated Test Creation With Selenium IDE Plugins

  • 1. Efficient Automated Test Creation With Selenium IDE Plugins Selenium Conference 2011 San Francisco 4th April 2011
  • 2. Samit Badle @samitbadle http://blog.reallysimplethoughts.com
  • 3. Goals • Give you a taste of creating a Selenium IDE plugin • Make you aware of the code in various files by completing the TODOs in the exercises • Introduce you to ideas for efficiently creating tests or test data
  • 4. Agenda • Brief introduction • Create a Selenium IDE plugin with – Menu and Toolbar buttons – Selenium IDE Plugin API – Preferences – Command Builder • Ideas to efficiently create tests
  • 5. Getting Ready • Install the latest version of Firefox – Either Firefox 3.6.16 or Firefox 4.0 • Install 7-Zip or your favorite zip tool • Download the WorkshopFiles.zip – http://links.reallysimplethoughts.com/files/Wor kshopFiles.zip
  • 6. Using WorkshopFiles.zip • Extract WorkshopFiles.zip • Install the special version of Selenium IDE (selenium-ide-multi-workshop.xpi) included in it • The HandsOn folder contains the exercises • The Solutions folder contains the completed versions and pre-built plugins
  • 7. What are Selenium IDE Plugins? Demos!
  • 8. Where to find them? • Selenium download page http://seleniumhq.org/download/ • Firefox add-ons page https://addons.mozilla.org/en-US/firefox/ • Other places on the Internet Google ☺
  • 11. Efficient Automated Test Creation? “Automated Tests are Cool!” “Automating Generation of Automated Tests is Even Cooler.” “But How?”
  • 12. “Be Efficient” Selenium IDE Plugin Here’s How! • Add “Write My Test” to the context menu • When I click on it, write my test for me
  • 13. “Be Efficient” Selenium IDE Plugin The Benefits • Capture test data or test commands directly • Direct access to the web page • Reuse code from Selenium IDE and Selenium
  • 14. Demo!
  • 15. Be Efficient In Action • Open Selenium IDE • In Firefox, open www.bing.com • Type selenium in search box • Hit the enter key • Right click on the results web page • Select Write My Test! • Check the generated test case • Execute the test case (maybe with highlight elements plugin)
  • 16. Be Efficient In Action
  • 17. Be Efficient In Action
  • 18. Be Efficient In Action
  • 19. Be Efficient In Action
  • 20. Be Efficient In Action
  • 21. Be Efficient Code Main code Installation / registration code User interface User interface styling Preferences defaults Files required for a Firefox add-on
  • 23. Simple Firefox Add-on • XPI (zippy) • Install Manifest (install.rdf) • Chrome Manifest (chrome.manifest) • Overlay containing a menu and toolbar button • Style-sheet for the toolbar button • Icon for the toolbar button
  • 25. Your Turn • Explore the files in the first exercise HandsOn/selenium-ide_be-efficient_ex1 • Complete the TODO in the following files – Install Manifest (install.rdf) – Chrome Manifest (chrome.manifest) – Overlay (ovIDE.xul) – Style sheet (beefficient.css)
  • 26. Package and Install • Create a zip of all files in src folder • Change the file extension from .zip to .xpi • Open this xpi file in Firefox • Click on install button • Restart to complete
  • 28. Result • New menu item in the Options menu in Selenium IDE • A new toolbar button on the right side • Clicking on the menu item or toolbar item results in a simple alert message
  • 30. Plugin API Functions • addPlugin • addPluginProvidedIdeExtension • addPluginProvidedFormatter • addPluginProvidedUserExtension
  • 31. Using the Plugin API • Code to register plugin with Selenium IDE • Load the real plugin code as an IDE extension • Lots of boilerplate code
  • 32. Using My pluginframework.js Lots of boilerplate code hidden away in pluginframework.js and reduces the required code to two lines.
  • 34. Your Turn • Explore the files in the second exercise HandsOn/selenium-ide_be-efficient_ex2 • Complete the TODO in the following files – Chrome Manifest (chrome.manifest) – Setup overlay (setup.xul) – Setup code (setup.js) – Overlay (ovIDE.xul) – Real plugin code (BeEfficient.js)
  • 35. Result • Be Efficient Plugin now shows up in Plugins tab of the Selenium IDE options dialog • The plugin code in BeEfficient and ovIDE.xul can now change the enabled state from the UI
  • 38. Preferences • Lot of support is built into Firefox • Involves mostly boilerplate code
  • 39. Preferences • Create defaults for the preferences • Create dialog to allow user to change preference • Create an observer to receive notification of changes • And one of the following (or both): – Define options in Install manifest – Create UI (usually menu) to show Options dialog
  • 41. Your Turn • Explore the files in the third exercise HandsOn/selenium-ide_be-efficient_ex3 • Complete the TODO in the following files – Preference defaults (defaults.js) – Options dialog (options.xul) – Plugin code (BeEfficient.js) – Install Manifest (install.rdf)
  • 42. Result • Be Efficient Plugin options dialog is available • The options dialog can now be opened from the menu item • The preference can be seen in about:config • The preference and the UI elements are now in sync
  • 46. Command Builder • Puts a menu item in the context menu on the web page when Selenium IDE is open • Three types: Action, Accessor, Util • Util type will be available with Selenium IDE v1.0.11
  • 47. Util Command Builder • Register the Util command builder functions • Prepare (builder) function – Returns the menu item to show • Execute function – Called when the menu item is clicked – Can return zero or more commands to add to the test case
  • 48. Be Efficient Command Builder • When the Write My Test! context menu item is pressed, create commands for the following • Verify page title • Wait for all results • Verify each result
  • 49. Your Turn • Explore the files in the third exercise HandsOn/selenium-ide_be-efficient_ex4 • Complete the TODO in the following file – Plugin code (BeEfficient.js)
  • 50. Result • Write My Test! context menu is available on the web page when Selenium IDE is open • Clicking on the write my test on bing.com search results page will generate your test
  • 51. Be Efficient In Action • Open Selenium IDE • In Firefox, open www.bing.com • Type selenium in search box • Hit the enter key • Right click on the results web page • Select Write My Test! • Check the generated test case • Execute the test case (maybe with highlight elements plugin)
  • 52. Resources for Selenium IDE Plugins • Selenium IDE Plugin Documentation http://seleniumhq.org/projects/ide/plugins.html • My Blog http://blog.reallysimplethoughts.com/
  • 53. Resources for Firefox Add-ons https://developer.mozilla.org/en/XUL_School https://developer.mozilla.org/en/Building_an_Extension https://developer.mozilla.org/En/Firefox_addons_developer_guide http://robertnyman.com/2009/01/24/how-to-develop-a-firefox-extension/ http://books.mozdev.org/chapters/index.html https://developer.mozilla.org/en/Creating_XPCOM_Components http://blog.mozilla.com/addons/2009/01/28/how-to-develop-a-firefox-extension/ http://roachfiend.com/archives/2004/12/08/how-to-create-firefox-extensions/
  • 54. Time to Celebrate! Thanks for Joining!
  • 55. Questions? Feel free to chat with me anytime