SlideShare a Scribd company logo
Test_Automation using Selenium.ppt
Automation using Selenium
Authored & Presented by : Chinmay Sathe & Amit Prabhu
Cybage Software Pvt. Ltd.
Agenda
What is Selenium ?
• Selenium Components
• Advantages of Selenium
• Selenese-The language of Selenium
 Automating Tests using Selenium
• Prerequisites and Test Bed Setup
• Scripting Techniques and Best Practices
 Known Issues & Workarounds
 Benefits to Organization
 Drawbacks
 Selenium Reference on the Internet
• Source Repository
• Selenium User Forums
• Selenium Developer Forums
• Selenium-How to Contribute
What is Selenium ?
 Automation tool for web based applications
 Used for functional regression testing
 Uses JavaScript
 Embeds test automation engine in your browser
Selenium
Selenium Components
1. Selenium Core
 Core engine of Selenium
 JavaScript/DHTML library
 Other Selenium components such as IDE and RC
build on it
 Supports a variety of platforms
 Windows: Internet Explorer 6.0 and 7.0 , FireFox 0.8 to 2.0
 Mac OS X: Safari 2.0.4+, FireFox 0.8 to 2.0 , Camino 1.0a1
 Linux: FireFox 0.8 to 2.0 Konqueror
Selenium Components
2. Selenium IDE
 Integrated development
environment for Selenium tests
 Enables you to record a browser
session
 Implemented as a Mozilla FireFox
extension
 Allows you to record, edit, and
debug tests.
Selenium Components..
3. Selenium Remote Control (RC)
 Provides Selenium Server
 Start/Stop/Control supported browsers
 Script web application UI tests
 Works with any HTTP website
 Uses any JavaScript enabled browser
How Selenium RC Works
Advantages of Selenium
 Open source, free software
 Easy Installation
 Scripting Techniques :
Easy recording and playback of scripts
Modular scripts
 Compatibility :
 Multiple operating systems (Windows, Linux, Mac)
 Allows cross browser testing (Record in FireFox, execute in IE)
 No dedicated machine required for test execution (user can
work in parallel).
 Integration with third party tools.
 Example : RTH Test Case Management Tool.
Selenese-The language of Selenium
Selenese consists of Actions, Accessors, Element Locators and Variables
• Actions - Commands for the selenese language to perform a
action on a web application
Script performs a particular action
Typically take element locator and possibly a value
Examples :
1.Open- open a url
2.Click- click button, link, etc..
3.Type- type text in text field
Selenese-The language of Selenium
• Accessors – Verification / Validation checkpoints for the tool
Data related
Take only element locators
Examples :
1. store(locator,variable)
2. verify(locator,pattern)
3.eval- return value of JS expression
4. bodyText-contents of HTML body
Selenese-The language of Selenium
• Element Locators
 These can be id, name, identifier, link, etc..
 Variables used in scripting
• Information regarding Actions, Accessors can be found in class ‘Selenium
Driver’ in installed directory
For e.g. C:Seleniumselenium-remote-control-0.9.0rubydocindex.html
Sample Script
require "selenium"
require "test/unit"
def test_new
@selenium.open "/"
@selenium.type "q", "Hello"
@selenium.click "btnG"
@selenium.wait_for_page_to_load "30000"
begin
assert @selenium.is_text_present("Hello is a new way to look at
pictures with friends and family. )
rescue Test::Unit::AssertionFailedError
@verification_errors << $!
end
temp = @selenium.get_text("//div[2]/div[1]")
end
end
Automating Tests using Selenium
 Software :
 Selenium IDE, Mozilla FireFox for script recording
 Selenium Server, Java for running scripts
 Configuration :
 Set path variables
 Use –multiWindow option while starting server
 Resource :
 Users… should have basic scripting knowledge
 Hardware… No specific requirement the basic configuration for a server –
P4, 512 MB RAM is good enough.
Prerequisites and Test Bed Setup
In order to ensure the quality of scripts and reduce maintenance, it is best
to have scripting techniques and best practices. Some of which are…
 Comments and proper formatting in scripts
 Scripting considerations for integration with other tools
 Documentation of basic data required for scripts
 Documentation of new functions added for scripts
 Follow fixed, logical scripting format
 Include code to handle Selenium errors
 Scripting according to application specific issues
Scripting Techniques and Best Practices
Known Issues & Workarounds
Elements not found on page
Potential Causes :
Can happen due to execution speed of Selenium
Elements do not load on page in time
Fix :
Add code in scripts which waits for elements
Additional issues :
Sometimes existing elements on a page are not detected
Sometimes elements on a page have a same label
Solution :
Obtain exact element label from source code
Label can be used in scripts for accuracy
Steps :
Window id required for automated operations in
window
At times if id is not obtained during recording, go to
window and perform operations
Window id will be obtained after this action.
Handling of Popup windows
Option :
-multiWindow option handles potential frame problems
Causes :
At times required name of frame not obtained in recording
Fix :
Obtain frame label from source code
Also can be obtained from browser URL bar
Handling of Frames
Benefits to Organization
 Automation Benefits :
Usual benefits for automation e.g. Time saving
Time required for sanity reduced ( 12 man hours to 3 man hours, build
frequency of 4-5 builds a month )
 For one of the projects, Sanity suite automated : 243 test cases
Good Returns on Zero Investment
 Increasing Productivity
Cost saving as it is open-source
QA engineers get familiar with scripting languages like Ruby, Perl etc
apart from manual testing
 Caveat:
Full automation and maintenance has not been evaluated and that can be
a risk
Benefits to Organization
Drawbacks
 Lack of exhaustive formal guidance material
 Mozilla FireFox browser is required for script
recording
 Only works with web based applications
Selenium Reference on the Internet
Selenium Source Repository
 View : http://svn.openqa.org/fisheye/viewrep/selenium-
core/trunk
 To check out Selenium Core: svn co
https://svn.openqa.org/svn/selenium-core/trunk
Selenium User Forums
 Selenium Core
http://forums.openqa.org/forum.jspa?forumID=3
 Selenium IDE
http://forums.openqa.org/forum.jspa?forumID=2
 Selenium RC
http://forums.openqa.org/forum.jspa?forumID=13
Developer Forums
 http://forums.openqa.org/forum.jspa?forumID=4
 Post suggestions, feature requests, patches, etc..
 Development mailing list : selenium-core-dev-
subscribe@openqa.org
 Send emails in plain text format only
Selenium –How to Contribute
QA/User Contribution :
 Submit bug reports , with patches
 Helping out in forums
Development :
 Becoming a regular Selenium developer is on invite-only
basis
Questions
Thank You !!!
Ad

More Related Content

Similar to Test_Automation using Selenium.ppt (20)

4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
hemasubbu08
 
What is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptxWhat is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptx
Syntax Technologies
 
Selenium
SeleniumSelenium
Selenium
Satyam Pandey
 
Selenium
SeleniumSelenium
Selenium
jagdishdevabhaipatel
 
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfLesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Minh Quân Đoàn
 
Software Testing Tools Training
Software Testing Tools TrainingSoftware Testing Tools Training
Software Testing Tools Training
QEdge Tech
 
Selenium Primer
Selenium PrimerSelenium Primer
Selenium Primer
gueste1e4db
 
Leveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver ExampleLeveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver Example
TechWell
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Choosing right-automation-tool
Choosing right-automation-toolChoosing right-automation-tool
Choosing right-automation-tool
BabuDevanandam
 
Selenium
SeleniumSelenium
Selenium
Jahan Murugassan
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
Karapet Sarkisyan
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
QUONTRASOLUTIONS
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
Applitools
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
MuhammadusmanRana10
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
Learning Slot
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
vivek_prahlad
 
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Selenium Testing The Complete Step-by-Step Tutorial.pdfSelenium Testing The Complete Step-by-Step Tutorial.pdf
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Steve Wortham
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-54&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
hemasubbu08
 
What is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptxWhat is Selenium Introduction to Selenium Testing.pptx
What is Selenium Introduction to Selenium Testing.pptx
Syntax Technologies
 
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdfLesson_06_Software_and_Automation_Testing_Frameworks.pdf
Lesson_06_Software_and_Automation_Testing_Frameworks.pdf
Minh Quân Đoàn
 
Software Testing Tools Training
Software Testing Tools TrainingSoftware Testing Tools Training
Software Testing Tools Training
QEdge Tech
 
Leveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver ExampleLeveraging Open Source Automation: A Selenium WebDriver Example
Leveraging Open Source Automation: A Selenium WebDriver Example
TechWell
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Choosing right-automation-tool
Choosing right-automation-toolChoosing right-automation-tool
Choosing right-automation-tool
BabuDevanandam
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
Karapet Sarkisyan
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Selenium Basics by Quontra Solutions
Selenium Basics by Quontra SolutionsSelenium Basics by Quontra Solutions
Selenium Basics by Quontra Solutions
QUONTRASOLUTIONS
 
Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully Mastering Test Automation: How to Use Selenium Successfully
Mastering Test Automation: How to Use Selenium Successfully
Applitools
 
Selenium Presentation at Engineering Colleges
Selenium Presentation at Engineering CollegesSelenium Presentation at Engineering Colleges
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
Interview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlotInterview Question & Answers for Selenium Freshers | LearningSlot
Interview Question & Answers for Selenium Freshers | LearningSlot
Learning Slot
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
vivek_prahlad
 
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Selenium Testing The Complete Step-by-Step Tutorial.pdfSelenium Testing The Complete Step-by-Step Tutorial.pdf
Selenium Testing The Complete Step-by-Step Tutorial.pdf
Steve Wortham
 

Recently uploaded (20)

Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast BrooklynBridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
i4jd41bk
 
Rococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th centuryRococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th century
Gema
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE  BY sweety Tamanna Mahapatra MSc PediatricAPGAR SCORE  BY sweety Tamanna Mahapatra MSc Pediatric
APGAR SCORE BY sweety Tamanna Mahapatra MSc Pediatric
SweetytamannaMohapat
 
How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18How to Configure Scheduled Actions in odoo 18
How to Configure Scheduled Actions in odoo 18
Celine George
 
Herbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptxHerbs Used in Cosmetic Formulations .pptx
Herbs Used in Cosmetic Formulations .pptx
RAJU THENGE
 
Kenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 CohortKenan Fellows Participants, Projects 2025-26 Cohort
Kenan Fellows Participants, Projects 2025-26 Cohort
EducationNC
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
Form View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo SlidesForm View Attributes in Odoo 18 - Odoo Slides
Form View Attributes in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18How to Create A Todo List In Todo of Odoo 18
How to Create A Todo List In Todo of Odoo 18
Celine George
 
Lecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptxLecture 1 Introduction history and institutes of entomology_1.pptx
Lecture 1 Introduction history and institutes of entomology_1.pptx
Arshad Shaikh
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast BrooklynBridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
Bridging the Transit Gap: Equity Drive Feeder Bus Design for Southeast Brooklyn
i4jd41bk
 
Rococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th centuryRococo versus Neoclassicism. The artistic styles of the 18th century
Rococo versus Neoclassicism. The artistic styles of the 18th century
Gema
 
"Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules""Basics of Heterocyclic Compounds and Their Naming Rules"
"Basics of Heterocyclic Compounds and Their Naming Rules"
rupalinirmalbpharm
 
dynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south Indiadynastic art of the Pallava dynasty south India
dynastic art of the Pallava dynasty south India
PrachiSontakke5
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdfRanking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Ranking_Felicidade_2024_com_Educacao_Marketing Educacional_V2.pdf
Rafael Villas B
 
Ad

Test_Automation using Selenium.ppt

  • 2. Automation using Selenium Authored & Presented by : Chinmay Sathe & Amit Prabhu Cybage Software Pvt. Ltd.
  • 3. Agenda What is Selenium ? • Selenium Components • Advantages of Selenium • Selenese-The language of Selenium  Automating Tests using Selenium • Prerequisites and Test Bed Setup • Scripting Techniques and Best Practices  Known Issues & Workarounds  Benefits to Organization  Drawbacks  Selenium Reference on the Internet • Source Repository • Selenium User Forums • Selenium Developer Forums • Selenium-How to Contribute
  • 5.  Automation tool for web based applications  Used for functional regression testing  Uses JavaScript  Embeds test automation engine in your browser Selenium
  • 6. Selenium Components 1. Selenium Core  Core engine of Selenium  JavaScript/DHTML library  Other Selenium components such as IDE and RC build on it  Supports a variety of platforms  Windows: Internet Explorer 6.0 and 7.0 , FireFox 0.8 to 2.0  Mac OS X: Safari 2.0.4+, FireFox 0.8 to 2.0 , Camino 1.0a1  Linux: FireFox 0.8 to 2.0 Konqueror
  • 7. Selenium Components 2. Selenium IDE  Integrated development environment for Selenium tests  Enables you to record a browser session  Implemented as a Mozilla FireFox extension  Allows you to record, edit, and debug tests.
  • 8. Selenium Components.. 3. Selenium Remote Control (RC)  Provides Selenium Server  Start/Stop/Control supported browsers  Script web application UI tests  Works with any HTTP website  Uses any JavaScript enabled browser
  • 10. Advantages of Selenium  Open source, free software  Easy Installation  Scripting Techniques : Easy recording and playback of scripts Modular scripts  Compatibility :  Multiple operating systems (Windows, Linux, Mac)  Allows cross browser testing (Record in FireFox, execute in IE)  No dedicated machine required for test execution (user can work in parallel).  Integration with third party tools.  Example : RTH Test Case Management Tool.
  • 11. Selenese-The language of Selenium Selenese consists of Actions, Accessors, Element Locators and Variables • Actions - Commands for the selenese language to perform a action on a web application Script performs a particular action Typically take element locator and possibly a value Examples : 1.Open- open a url 2.Click- click button, link, etc.. 3.Type- type text in text field
  • 12. Selenese-The language of Selenium • Accessors – Verification / Validation checkpoints for the tool Data related Take only element locators Examples : 1. store(locator,variable) 2. verify(locator,pattern) 3.eval- return value of JS expression 4. bodyText-contents of HTML body
  • 13. Selenese-The language of Selenium • Element Locators  These can be id, name, identifier, link, etc..  Variables used in scripting • Information regarding Actions, Accessors can be found in class ‘Selenium Driver’ in installed directory For e.g. C:Seleniumselenium-remote-control-0.9.0rubydocindex.html
  • 14. Sample Script require "selenium" require "test/unit" def test_new @selenium.open "/" @selenium.type "q", "Hello" @selenium.click "btnG" @selenium.wait_for_page_to_load "30000" begin assert @selenium.is_text_present("Hello is a new way to look at pictures with friends and family. ) rescue Test::Unit::AssertionFailedError @verification_errors << $! end temp = @selenium.get_text("//div[2]/div[1]") end end
  • 16.  Software :  Selenium IDE, Mozilla FireFox for script recording  Selenium Server, Java for running scripts  Configuration :  Set path variables  Use –multiWindow option while starting server  Resource :  Users… should have basic scripting knowledge  Hardware… No specific requirement the basic configuration for a server – P4, 512 MB RAM is good enough. Prerequisites and Test Bed Setup
  • 17. In order to ensure the quality of scripts and reduce maintenance, it is best to have scripting techniques and best practices. Some of which are…  Comments and proper formatting in scripts  Scripting considerations for integration with other tools  Documentation of basic data required for scripts  Documentation of new functions added for scripts  Follow fixed, logical scripting format  Include code to handle Selenium errors  Scripting according to application specific issues Scripting Techniques and Best Practices
  • 18. Known Issues & Workarounds
  • 19. Elements not found on page Potential Causes : Can happen due to execution speed of Selenium Elements do not load on page in time Fix : Add code in scripts which waits for elements Additional issues : Sometimes existing elements on a page are not detected Sometimes elements on a page have a same label Solution : Obtain exact element label from source code Label can be used in scripts for accuracy
  • 20. Steps : Window id required for automated operations in window At times if id is not obtained during recording, go to window and perform operations Window id will be obtained after this action. Handling of Popup windows
  • 21. Option : -multiWindow option handles potential frame problems Causes : At times required name of frame not obtained in recording Fix : Obtain frame label from source code Also can be obtained from browser URL bar Handling of Frames
  • 23.  Automation Benefits : Usual benefits for automation e.g. Time saving Time required for sanity reduced ( 12 man hours to 3 man hours, build frequency of 4-5 builds a month )  For one of the projects, Sanity suite automated : 243 test cases Good Returns on Zero Investment  Increasing Productivity Cost saving as it is open-source QA engineers get familiar with scripting languages like Ruby, Perl etc apart from manual testing  Caveat: Full automation and maintenance has not been evaluated and that can be a risk Benefits to Organization
  • 24. Drawbacks  Lack of exhaustive formal guidance material  Mozilla FireFox browser is required for script recording  Only works with web based applications
  • 25. Selenium Reference on the Internet
  • 26. Selenium Source Repository  View : http://svn.openqa.org/fisheye/viewrep/selenium- core/trunk  To check out Selenium Core: svn co https://svn.openqa.org/svn/selenium-core/trunk
  • 27. Selenium User Forums  Selenium Core http://forums.openqa.org/forum.jspa?forumID=3  Selenium IDE http://forums.openqa.org/forum.jspa?forumID=2  Selenium RC http://forums.openqa.org/forum.jspa?forumID=13
  • 28. Developer Forums  http://forums.openqa.org/forum.jspa?forumID=4  Post suggestions, feature requests, patches, etc..  Development mailing list : selenium-core-dev- [email protected]  Send emails in plain text format only
  • 29. Selenium –How to Contribute QA/User Contribution :  Submit bug reports , with patches  Helping out in forums Development :  Becoming a regular Selenium developer is on invite-only basis