SlideShare a Scribd company logo
Automation using Selenium 
Quontra solutions 
www.quontrasolutions.co.uk 
Call us @ 20-3734-1498 / 1499
What is Selenium ? 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
 Automation tool for web based applications 
 Used for functional regression testing 
 Uses JavaScript 
 Embeds test automation engine in your browser 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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. 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
How Selenium RC Works 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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. 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Selenese-The language of Selenium 
• Element Locators 
 These can be id, name, identifier, link, etc.. 
 Variables used in scripting 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Automating Tests using Selenium 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Prerequisites and Test Bed Setup 
 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. 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Scripting Techniques and Best Practices 
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Known Issues & Workarounds 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Handling of Popup windows 
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. 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Handling of Frames 
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Benefits to Organization 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
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 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
Drawbacks 
 Lack of exhaustive formal guidance material 
 Mozilla FireFox browser is required for script 
recording 
 Only works with web based applications 
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499

More Related Content

More from Quontra Solutions

Network security by quontra solutions uk
Network security by quontra solutions ukNetwork security by quontra solutions uk
Network security by quontra solutions uk
Quontra Solutions
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
Quontra Solutions
 
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra SolutionsInformatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Quontra Solutions
 
Informatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutionsInformatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutions
Quontra Solutions
 
Dataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra SolutionsDataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra Solutions
Quontra Solutions
 
Selenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutionsSelenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutions
Quontra Solutions
 

More from Quontra Solutions (6)

Network security by quontra solutions uk
Network security by quontra solutions ukNetwork security by quontra solutions uk
Network security by quontra solutions uk
 
Introduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutionsIntroduction to .net FrameWork by QuontraSolutions
Introduction to .net FrameWork by QuontraSolutions
 
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra SolutionsInformatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
Informatica Metadata Exchange Frequently Asked Questions by Quontra Solutions
 
Informatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutionsInformatica metadata exchange frequently asked questions by quontra solutions
Informatica metadata exchange frequently asked questions by quontra solutions
 
Dataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra SolutionsDataware house Introduction By Quontra Solutions
Dataware house Introduction By Quontra Solutions
 
Selenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutionsSelenium overview ppt by quontra solutions
Selenium overview ppt by quontra solutions
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Diana Rendina
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 

Automation using selenium webdriver by Quontra Solutions

  • 1. Automation using Selenium Quontra solutions www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 2. What is Selenium ? www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 3.  Automation tool for web based applications  Used for functional regression testing  Uses JavaScript  Embeds test automation engine in your browser www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 4. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 5. 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. www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 6. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 7. How Selenium RC Works www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 8. 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. www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 9. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 10. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 11. Selenese-The language of Selenium • Element Locators  These can be id, name, identifier, link, etc..  Variables used in scripting www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 12. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 13. Automating Tests using Selenium www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 14. Prerequisites and Test Bed Setup  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. www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 15. Scripting Techniques and Best Practices 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 16. Known Issues & Workarounds www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 17. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 18. Handling of Popup windows 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. www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 19. Handling of Frames 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 20. Benefits to Organization www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 21. 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 www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 22. Drawbacks  Lack of exhaustive formal guidance material  Mozilla FireFox browser is required for script recording  Only works with web based applications www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499
  • 23. www.quontrasolutions.co.uk Call us @ 20-3734-1498 / 1499