SlideShare a Scribd company logo
 
Automated Web Testing using Selenium Perficient China Waylon Zhang Yahoo!m:  waylon_zhang2008 [email_address]
Agenda Warm-up  Introduction of Selenium Framework Troubleshooting of Selenium Practice Q&A
Warm-up Google Advance Search Function
Prerequisite Development experience in Java language Knowledge of Xpath language Basic knowledge of HTML/Junit/TestNg Knowledge of The Same Origin Policy
What is Selenium? Selenium is a suite of tools to automate web app testing across many platforms.   Selenium Core: DHTML test execution framework Selenium IDE: Firefox extension – record and playback Selenium Remote Control Server: launches/kills browser, HTTP Proxy Client libraries Selenium Grid Run Selenium tests in parallel
Selenium components *Selenese is the set of Selenium Commands that run you tests. Don’t support If or For (While) statements C#, Java, Perl, PHP, Python, Ruby Selenese *Selenese  Programming Languages Yes No No Support I&O Yes No No Need Jre Yes Yes No Different Domain Yes Yes Yes Support Https/SSL No No Yes AUT Server side installed Firefox, IE,Safari Firefox Firefox, IE,Safari Browsers Selenium Remote Control Selenium IDE Selenium Core
How to use Selenium RC to develop
How Selenium RC Works?
How Selenium RC Works? (cont.)
Selenium Solutions of HTTPS Support HTTPS IE (supported by default, configure IE browser) FireFox (Selenium server doesn’t support add-ons configurations) Safari   (doesn’t support HTTPS configurations, so Selenium can’t run on it)
Selenium to Test Click Flash (1/2)
Selenium to test Click Flash (2/2) Get help from Developer javascript:WTKSendFlashClick( "{\"Page\":\"Exterior\", \"ClickType\":\"angleClick\",\"ClickParams\":{\"Direction\":\"left\"}}" ) Use Selenium’s API selenium.runScript(target)
Selenium to test Ajax Wait For It…
Add API to Selenium (1/2)  Example: add Function of  getTableRows(locator) to Selenium Server Side Add js to user-extensions.js Save the user-extensions.js under the folder where selenium server resides start selenium server with user-extensions.js
Add API to Selenium (2/2)  Example: add Function of  getTableRows(locator) to Selenium Client Side Add API to Selenium.java under package of com.thoughtworks.selenium  Add function to DefaultSelenium.java under package of com.thoughtworks.selenium
Selenium Open Issues How to test GWT web applications?
Problems in Selenium Verbose  Locators everywhere Coupling UI locators, actions, and assertions are coupled Not expressive What does the UI look like? Speed Since IE is lack of native XPath support, so tests run in IE are very slow Record and Play Re-labeling a button or moving it to another part of the window may require the test to be re-recorded Refactor Seems to be difficult Reusable Less likely
Tellurium’s solution package com.perficient.tellurium.webapp.ui import org.tellurium.dsl.DslContext public class TelluriumModule extends DslContext { public void defineUi(){ ui.Container(uid: "root", clocator: [tag: "table", name: "Tellurium"]){ InputBox(uid: "firstName", clocator: [tag: "input", type: "text", name: "FirstName"]) InputBox(uid: "lastName", clocator: [tag: "input", type: "text", name: "LastName"]) InputBox(uid: "fullName", clocator: [tag: "input", type: "text", name: "FullName"]) InputBox(uid: "save", clocator: [tag: "input", type: "button", value: "Save"], respond:  ["click"]) } } public void getFullName(String firstName,String lastName){ type "root.firstName",firstName type "root.lastName",lastName pause 500 click "root.save" } }
What is Tellurium? UI module based web testing framework built on top of Selenium UI is defined in Groovy class and tests can be written in  Java (JUnit 4 or TestNG) Groovy Pure DSL script Handles the mapping from Java object to UI  Reference:  http:// code.google.com/p/aost /
What challenges are addressed in Tellurium No longer “record and play” style, but UI module oriented Separated Robust Easy to refactor
What challenges are addressed in Tellurium Support jQuery Selector useJQuerySelector() disableJQuerySelector()
Summarization: Advantage/Disadvantage Involved new language  Very new, some potential risks we don’t know No longer “record and play” style, but UI module oriented Easy to refactor Easy to use UI and tests are separated Faster performance in IE  Ideally only defining the HTML elements is required as the entry criteria of scripting Tellurium Hard to refactor Very slow in IE UI locators, actions, and assertions are coupled Record and Play requires little or no software development  It’s required to have both the HTML and the back-end code ready before we start scripting Selenium Disadvantage Advantage Pre-condition
Best Practices To Automate or Not to Automate? That is the Question! The test framework should be approved, documented, reviewed. Structure scripts with minimal dependencies. Test automation is a fulltime effort, not a sideline. A dedicated team is required.
Q&A
References Tellurium Framework http:// code.google.com/p/aost /   Guidelines for Automation framework design http://knowledgeinbox.com/articles/automation/frameworks/guidelines-for-automation-framework-design/ 10 Step Test Automation Approach - Guide for automation testers http://testing.thoughtworks.com/article10step

More Related Content

What's hot (20)

PPTX
Introduction to Selenium Web Driver
Return on Intelligence
 
PPTX
Selenium test automation
Srikanth Vuriti
 
PDF
Automation Testing using Selenium
Naresh Chintalcheru
 
PPT
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
PDF
Web application testing with Selenium
Kerry Buckley
 
PPT
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
PPT
Selenium Concepts
Swati Bansal
 
PPT
Web Test Automation with Selenium
vivek_prahlad
 
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
PDF
Selenium Maven With Eclipse | Edureka
Edureka!
 
PPTX
Automation Testing
Sun Technlogies
 
PPTX
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
PPT
Automated Testing vs Manual Testing
didev
 
PPTX
Automation Framework Presentation
Ben Ngo
 
PPT
Automation With A Tool Demo
Nivetha Padmanaban
 
PPT
Selenium
Kalyan ch
 
PPTX
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Simplilearn
 
PDF
Cypress testing
Vladyslav Romanchenko
 
PPTX
Test automation framework
QACampus
 
PPT
Test Automation Framework Designs
Sauce Labs
 
Introduction to Selenium Web Driver
Return on Intelligence
 
Selenium test automation
Srikanth Vuriti
 
Automation Testing using Selenium
Naresh Chintalcheru
 
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
Web application testing with Selenium
Kerry Buckley
 
Selenium Presentation at Engineering Colleges
Vijay Rangaiah
 
Selenium Concepts
Swati Bansal
 
Web Test Automation with Selenium
vivek_prahlad
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 
Selenium Maven With Eclipse | Edureka
Edureka!
 
Automation Testing
Sun Technlogies
 
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
Automated Testing vs Manual Testing
didev
 
Automation Framework Presentation
Ben Ngo
 
Automation With A Tool Demo
Nivetha Padmanaban
 
Selenium
Kalyan ch
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Simplilearn
 
Cypress testing
Vladyslav Romanchenko
 
Test automation framework
QACampus
 
Test Automation Framework Designs
Sauce Labs
 

Viewers also liked (15)

DOCX
Pfm poblacion
Jose Antonio Tito
 
DOCX
sredharselvam resume
sredhar selvam
 
PPTX
III Jornada de Perinatologia de Joinville
Marcio Fossari
 
PPTX
Prezentare spocs dec._2011_agenda_digitala
Monica ANGHEL
 
PDF
CodeIgniter For Project : Lesson 104 - Controller & View
Weerayut Hongsa
 
PPTX
Gamefish ireland website
kscull
 
PDF
Gill TESOL 2010 Talkng At Length: Strategies and Genres of Extended Discourse
kategill
 
PPT
Code igniter 20160119
ko donghwi
 
PDF
Titulada presencial
Nayey Alarcon
 
PPS
Barbaresques et esclavage des blancs
Aschkel Levi
 
PDF
Listas jornada mañana grupos de media fortalecida
colegiommc
 
PDF
Calendario academico 2017
nayey rodriguez
 
PDF
Agosto 2016 apoyos_005695
nayey rodriguez
 
PDF
[eh2016] - Novità Prestashop 1.7 - Luca Mastroianni, Roberto Di Stefano, Anto...
Ecommerce HUB
 
PDF
[eh2016] - Web Advertising per Ecommerce: strategie e pratiche di automazione...
Ecommerce HUB
 
Pfm poblacion
Jose Antonio Tito
 
sredharselvam resume
sredhar selvam
 
III Jornada de Perinatologia de Joinville
Marcio Fossari
 
Prezentare spocs dec._2011_agenda_digitala
Monica ANGHEL
 
CodeIgniter For Project : Lesson 104 - Controller & View
Weerayut Hongsa
 
Gamefish ireland website
kscull
 
Gill TESOL 2010 Talkng At Length: Strategies and Genres of Extended Discourse
kategill
 
Code igniter 20160119
ko donghwi
 
Titulada presencial
Nayey Alarcon
 
Barbaresques et esclavage des blancs
Aschkel Levi
 
Listas jornada mañana grupos de media fortalecida
colegiommc
 
Calendario academico 2017
nayey rodriguez
 
Agosto 2016 apoyos_005695
nayey rodriguez
 
[eh2016] - Novità Prestashop 1.7 - Luca Mastroianni, Roberto Di Stefano, Anto...
Ecommerce HUB
 
[eh2016] - Web Advertising per Ecommerce: strategie e pratiche di automazione...
Ecommerce HUB
 
Ad

Similar to Automated Web Testing Using Selenium (20)

PDF
Tellurium At Rich Web Experience2009
John.Jian.Fang
 
ODP
Web Testen mit Selenium
openForce Information Technology GesmbH
 
PDF
Selenium Testing: A Comprehensive Guide to Automated Web Testing
pCloudy
 
PDF
Selenide
DataArt
 
PDF
Web UI test automation instruments
Artem Nagornyi
 
PDF
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
PDF
Tellurium.A.New.Approach.For.Web.Testing.V5
John.Jian.Fang
 
PDF
Manageable Robust Automated Ui Test
John.Jian.Fang
 
PPTX
Selenium ui paradigm - DDD North 2
Nathan Gloyn
 
PDF
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
PPTX
Selenium Automation
Pratyush Majumdar
 
PDF
Tellurium.A.New.Approach.For.Web.Testing
John.Jian.Fang
 
PDF
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
PPTX
Introduction to selenium
Khaja Moiz Uddin
 
PDF
Selenium Automation Testing - A Complete Guide
Abhay Kumar
 
PDF
Selenium Automation Testing - A Complete Guide.pdf
flufftailshop
 
ODP
Integrating Selenium testing infrastructure into Scala Project
Knoldus Inc.
 
PPT
Selenium Primer
gueste1e4db
 
PPT
Selenium
Daksh Sharma
 
PPTX
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
hemasubbu08
 
Tellurium At Rich Web Experience2009
John.Jian.Fang
 
Selenium Testing: A Comprehensive Guide to Automated Web Testing
pCloudy
 
Selenide
DataArt
 
Web UI test automation instruments
Artem Nagornyi
 
An Overview of Selenium Grid and Its Benefits
Shubham Joshi
 
Tellurium.A.New.Approach.For.Web.Testing.V5
John.Jian.Fang
 
Manageable Robust Automated Ui Test
John.Jian.Fang
 
Selenium ui paradigm - DDD North 2
Nathan Gloyn
 
How To Use Selenium Successfully (Java Edition)
Dave Haeffner
 
Selenium Automation
Pratyush Majumdar
 
Tellurium.A.New.Approach.For.Web.Testing
John.Jian.Fang
 
Selenium Automation Testing - A Complete Guide.pdf
kalichargn70th171
 
Introduction to selenium
Khaja Moiz Uddin
 
Selenium Automation Testing - A Complete Guide
Abhay Kumar
 
Selenium Automation Testing - A Complete Guide.pdf
flufftailshop
 
Integrating Selenium testing infrastructure into Scala Project
Knoldus Inc.
 
Selenium Primer
gueste1e4db
 
Selenium
Daksh Sharma
 
4&5.pptx SOFTWARE TESTING UNIT-4 AND UNIT-5
hemasubbu08
 
Ad

Recently uploaded (20)

PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
July Patch Tuesday
Ivanti
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 

Automated Web Testing Using Selenium

  • 1.  
  • 2. Automated Web Testing using Selenium Perficient China Waylon Zhang Yahoo!m: waylon_zhang2008 [email_address]
  • 3. Agenda Warm-up Introduction of Selenium Framework Troubleshooting of Selenium Practice Q&A
  • 4. Warm-up Google Advance Search Function
  • 5. Prerequisite Development experience in Java language Knowledge of Xpath language Basic knowledge of HTML/Junit/TestNg Knowledge of The Same Origin Policy
  • 6. What is Selenium? Selenium is a suite of tools to automate web app testing across many platforms. Selenium Core: DHTML test execution framework Selenium IDE: Firefox extension – record and playback Selenium Remote Control Server: launches/kills browser, HTTP Proxy Client libraries Selenium Grid Run Selenium tests in parallel
  • 7. Selenium components *Selenese is the set of Selenium Commands that run you tests. Don’t support If or For (While) statements C#, Java, Perl, PHP, Python, Ruby Selenese *Selenese Programming Languages Yes No No Support I&O Yes No No Need Jre Yes Yes No Different Domain Yes Yes Yes Support Https/SSL No No Yes AUT Server side installed Firefox, IE,Safari Firefox Firefox, IE,Safari Browsers Selenium Remote Control Selenium IDE Selenium Core
  • 8. How to use Selenium RC to develop
  • 10. How Selenium RC Works? (cont.)
  • 11. Selenium Solutions of HTTPS Support HTTPS IE (supported by default, configure IE browser) FireFox (Selenium server doesn’t support add-ons configurations) Safari (doesn’t support HTTPS configurations, so Selenium can’t run on it)
  • 12. Selenium to Test Click Flash (1/2)
  • 13. Selenium to test Click Flash (2/2) Get help from Developer javascript:WTKSendFlashClick( "{\"Page\":\"Exterior\", \"ClickType\":\"angleClick\",\"ClickParams\":{\"Direction\":\"left\"}}" ) Use Selenium’s API selenium.runScript(target)
  • 14. Selenium to test Ajax Wait For It…
  • 15. Add API to Selenium (1/2) Example: add Function of getTableRows(locator) to Selenium Server Side Add js to user-extensions.js Save the user-extensions.js under the folder where selenium server resides start selenium server with user-extensions.js
  • 16. Add API to Selenium (2/2) Example: add Function of getTableRows(locator) to Selenium Client Side Add API to Selenium.java under package of com.thoughtworks.selenium Add function to DefaultSelenium.java under package of com.thoughtworks.selenium
  • 17. Selenium Open Issues How to test GWT web applications?
  • 18. Problems in Selenium Verbose Locators everywhere Coupling UI locators, actions, and assertions are coupled Not expressive What does the UI look like? Speed Since IE is lack of native XPath support, so tests run in IE are very slow Record and Play Re-labeling a button or moving it to another part of the window may require the test to be re-recorded Refactor Seems to be difficult Reusable Less likely
  • 19. Tellurium’s solution package com.perficient.tellurium.webapp.ui import org.tellurium.dsl.DslContext public class TelluriumModule extends DslContext { public void defineUi(){ ui.Container(uid: "root", clocator: [tag: "table", name: "Tellurium"]){ InputBox(uid: "firstName", clocator: [tag: "input", type: "text", name: "FirstName"]) InputBox(uid: "lastName", clocator: [tag: "input", type: "text", name: "LastName"]) InputBox(uid: "fullName", clocator: [tag: "input", type: "text", name: "FullName"]) InputBox(uid: "save", clocator: [tag: "input", type: "button", value: "Save"], respond: ["click"]) } } public void getFullName(String firstName,String lastName){ type "root.firstName",firstName type "root.lastName",lastName pause 500 click "root.save" } }
  • 20. What is Tellurium? UI module based web testing framework built on top of Selenium UI is defined in Groovy class and tests can be written in Java (JUnit 4 or TestNG) Groovy Pure DSL script Handles the mapping from Java object to UI Reference: http:// code.google.com/p/aost /
  • 21. What challenges are addressed in Tellurium No longer “record and play” style, but UI module oriented Separated Robust Easy to refactor
  • 22. What challenges are addressed in Tellurium Support jQuery Selector useJQuerySelector() disableJQuerySelector()
  • 23. Summarization: Advantage/Disadvantage Involved new language Very new, some potential risks we don’t know No longer “record and play” style, but UI module oriented Easy to refactor Easy to use UI and tests are separated Faster performance in IE Ideally only defining the HTML elements is required as the entry criteria of scripting Tellurium Hard to refactor Very slow in IE UI locators, actions, and assertions are coupled Record and Play requires little or no software development It’s required to have both the HTML and the back-end code ready before we start scripting Selenium Disadvantage Advantage Pre-condition
  • 24. Best Practices To Automate or Not to Automate? That is the Question! The test framework should be approved, documented, reviewed. Structure scripts with minimal dependencies. Test automation is a fulltime effort, not a sideline. A dedicated team is required.
  • 25. Q&A
  • 26. References Tellurium Framework http:// code.google.com/p/aost / Guidelines for Automation framework design http://knowledgeinbox.com/articles/automation/frameworks/guidelines-for-automation-framework-design/ 10 Step Test Automation Approach - Guide for automation testers http://testing.thoughtworks.com/article10step

Editor's Notes

  • #8: Notes
  • #12: -firefoxProfileTemplate ${selenium.home}/profiles/firefoxProfile
  • #16: Add js to user-extensions.js: Selenium.prototype.getTableRows = function(locator) { /** * Gets the number of rows in a table. * * @param locator element locator for table * @return number of rows in the table, 0 if none */ var table = this.browserbot.findElement(locator); return table.rows.length.toString(); }; Selenium.java: String getTableRows(String locator); DefaultSelenium.java: public String getTableRows(String locator){ return commandProcessor.getString("getTableRows", new String[] {locator,}); } Test Method: public void testTables() throws InterruptedException{ selenium.open("http://www.w3schools.com/tags/tag_table.asp"); Thread. sleep (10000); String rows= selenium.getTableRows("//table[@id='table3']"); System. out .println("rows count= "+rows); }
  • #17: Add js to user-extensions.js: Selenium.prototype.getTableRows = function(locator) { /** * Gets the number of rows in a table. * * @param locator element locator for table * @return number of rows in the table, 0 if none */ var table = this.browserbot.findElement(locator); return table.rows.length.toString(); }; Selenium.java: String getTableRows(String locator); DefaultSelenium.java: public String getTableRows(String locator){ return commandProcessor.getString("getTableRows", new String[] {locator,}); } Test Method: public void testTables() throws InterruptedException{ selenium.open("http://www.w3schools.com/tags/tag_table.asp"); Thread. sleep (10000); String rows= selenium.getTableRows("//table[@id='table3']"); System. out .println("rows count= "+rows); }
  • #22: XPath builder can build the XPath from the composite locator, i.e., a set of attributes. Starting with version 0.6.0, Tellurium supports jQuery selectors to address the problem of poor performance of XPath in Internet Explorer. jQuery selector builders are used to automatically generate jQuery selectors instead of XPath with the following advantages: Faster performance in IE. Leverage the power of jQuery to retrieve bulk data from the web by testing with one method call. New features provided by jQuery attribute selectors.
  • #25: Notes
  • #27: Notes