SlideShare a Scribd company logo
Selenium
An Introduction
Selenium
❖ What is it?
❖ What is it good for?
❖ How do I get started?
❖ What are the gotchas?
Selenium?
❖ AKA Webdriver
❖ Web automation/testing framework
❖ Tests run on real browsers
wd.get("http://www.metafilter.com/")
wd.find_element_by_link_text("FAQ").click()
Yesss Master...
Pros
❖ Realistic test conditions
❖ Cross-browser testing
❖ Popular & mature tech
Cons
❖ Slow
❖ Changing HTML may break tests
Uses
❖ Acceptance Testing
❖ Continuous Integration
❖ Monitoring
❖ TDD? Maybe?
Python example
from selenium.webdriver.firefox.webdriver import WebDriver
wd = WebDriver()
wd.implicitly_wait(60)
wd.get("http://www.metafilter.com/")
wd.find_element_by_link_text("FAQ").click()
assert "How do I sign up for a MetaFilter account?"
in wd.find_element_by_tag_name("html").text
PHP!
require_once 'php-webdriver';
$wd = new WebDriver();
$session = $wd->session();
$session->open("http://www.metafilter.com/");
$session->element("link text", "FAQ")->click();
$session->close();
assert(strpos(
$session->element("tag name", "html")->text(),
"How do I sign up for a MetaFilter account?"));
Java!
import org.openqa.selenium.*;
import static java.util.concurrent.TimeUnit.*;
FirefoxDriver wd = new FirefoxDriver();
wd.manage().timeouts().implicitlyWait(60, SECONDS);
wd.get("http://www.metafilter.com/");
wd.findElement(By.linkText("FAQ")).click();
assert wd.findElement(By.tagName("html")).getText()
.contains("How do I sign up for a MetaFilter account?")
wd.quit();
Getting started, option A
❖ Get Selenium server from seleniumhq.org
❖ Download language binding of your choice
❖ Write some code & play it back
Getting started, option B
➔ Get Selenium Builder from sebuilder.com
➔ Record your actions as tests
➔ Play back locally, or via server
➔ Export to code or JSON
➔ Run JSON via interpreters
Gotcha 1: Visibility
❖ Selenium respects display: none
❖ You can’t interact with something invisible
❖ Even if it’s in the HTML
Gotcha 2: Timing
❖ Page needs to load first
❖ Some Javascript has to execute too?
❖ Page changes dynamically?
Gotcha 2: Timing
❖ Wait for page elements
❖ Implicitly or explicitly
❖ Don’t use pause!
Gotcha 2: Timing
from selenium.webdriver.firefox.webdriver import WebDriver
wd = WebDriver()
wd.implicitly_wait(60)
wd.get("http://www.metafilter.com/")
wd.find_element_by_link_text("FAQ").click()
assert "How do I sign up for a MetaFilter account?"
in wd.find_element_by_tag_name("html").text
Gotcha 3: Locators
from selenium.webdriver.firefox.webdriver import WebDriver
wd = WebDriver()
wd.implicitly_wait(60)
wd.get("http://www.metafilter.com/")
wd.find_element_by_link_text("FAQ").click()
assert "How do I sign up for a MetaFilter account?"
in wd.find_element_by_tag_name("html").text
Gotcha 3: Locators
❖ Locators identify UI elements
❖ HTML changes can break locators
Gotcha 3: Locators
❖ Use simple, clean, robust locators
❖ Depends on your approach
❖ Text vs ID vs CSS
❖ Careful XPATH for the tough cases
Good & bad locators
id: home_link
id: 12094b
css: span.green
css: #rightbar > .menu > li:nth-of-type(3) > h5
css: .logout
xpath: //*[@id='menu']//input[3]
xpath: //header/div/div[1]/div[1]/a/h1/span[2]
Good & bad locators
id: home_link
id: 12094b
css: span.green
css: #rightbar > .menu > li:nth-of-type(3) > h5
css: .logout
xpath: //*[@id='menu']//input[3]
xpath: //header/div/div[1]/div[1]/a/h1/span[2]
Resources
❖ Selenium HQ
❖ A CI solution with Builder, Travis & Sauce
❖ Obligatory self-promotion!
Thank you! Questions?
@zarkonnen_com

More Related Content

What's hot

One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variables
Giacomo Zinetti
 
Introduction à AngularJS
Introduction à AngularJSIntroduction à AngularJS
Introduction à AngularJS
Nicolas PENNEC
 
Introduction To ASP.Net MVC
Introduction To ASP.Net MVCIntroduction To ASP.Net MVC
Introduction To ASP.Net MVC
Joe Wilson
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
Alan Richardson
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium Testing
Mary Jo Sminkey
 
jQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web PerformancejQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web Performance
dmethvin
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
ColdFusionConference
 
jQuery Conference Toronto
jQuery Conference TorontojQuery Conference Toronto
jQuery Conference Toronto
dmethvin
 
The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web Components
ColdFusionConference
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Faichi Solutions
 
Getting By Without "QA"
Getting By Without "QA"Getting By Without "QA"
Getting By Without "QA"
Dave King
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
Raymond Camden
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
Addy Osmani
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
Eric Wendelin
 
AngularJS at PyVo
AngularJS at PyVoAngularJS at PyVo
AngularJS at PyVo
Ladislav Prskavec
 
jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014
dmethvin
 
The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016
Matt Raible
 
Rapid Testing, Rapid Development
Rapid Testing, Rapid DevelopmentRapid Testing, Rapid Development
Rapid Testing, Rapid Development
mennovanslooten
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousa
Emma Armstrong
 
DOSUG Wicket 101
DOSUG Wicket 101DOSUG Wicket 101
DOSUG Wicket 101
Matthew McCullough
 

What's hot (20)

One step in the future: CSS variables
One step in the future: CSS variablesOne step in the future: CSS variables
One step in the future: CSS variables
 
Introduction à AngularJS
Introduction à AngularJSIntroduction à AngularJS
Introduction à AngularJS
 
Introduction To ASP.Net MVC
Introduction To ASP.Net MVCIntroduction To ASP.Net MVC
Introduction To ASP.Net MVC
 
Webdriver cheatsheets summary
Webdriver cheatsheets summaryWebdriver cheatsheets summary
Webdriver cheatsheets summary
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium Testing
 
jQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web PerformancejQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web Performance
 
Our application got popular and now it breaks
Our application got popular and now it breaksOur application got popular and now it breaks
Our application got popular and now it breaks
 
jQuery Conference Toronto
jQuery Conference TorontojQuery Conference Toronto
jQuery Conference Toronto
 
The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web Components
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
 
Getting By Without "QA"
Getting By Without "QA"Getting By Without "QA"
Getting By Without "QA"
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
 
AngularJS at PyVo
AngularJS at PyVoAngularJS at PyVo
AngularJS at PyVo
 
jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014
 
The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016The Art of Angular in 2016 - Devoxx France 2016
The Art of Angular in 2016 - Devoxx France 2016
 
Rapid Testing, Rapid Development
Rapid Testing, Rapid DevelopmentRapid Testing, Rapid Development
Rapid Testing, Rapid Development
 
Getting up and running with selenium for automated Code palousa
Getting up and running with selenium for automated  Code palousaGetting up and running with selenium for automated  Code palousa
Getting up and running with selenium for automated Code palousa
 
DOSUG Wicket 101
DOSUG Wicket 101DOSUG Wicket 101
DOSUG Wicket 101
 

Viewers also liked

Selenium Builder
Selenium BuilderSelenium Builder
Selenium Builder
David Stark
 
Introducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test DevelopmentIntroducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test Development
seleniumconf
 
Selenium Webdriver - jOpenSpace 2015
Selenium Webdriver - jOpenSpace 2015Selenium Webdriver - jOpenSpace 2015
Selenium Webdriver - jOpenSpace 2015
Michal Franc
 
Self-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriverSelf-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriver
seleniumconf
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
Prasad Sawant
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Atirek Gupta
 
Selenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applicationsSelenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applications
TSundberg
 
Java Collections Framework
Java  Collections  FrameworkJava  Collections  Framework
Java Collections Framework
guestd8c458
 
Java exception handling ppt
Java exception handling pptJava exception handling ppt
Java exception handling ppt
JavabynataraJ
 
Exception handling
Exception handlingException handling
Exception handling
Abhishek Pachisia
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
Return on Intelligence
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
kamal kotecha
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
Naresh Chintalcheru
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
Pavan Kumar
 
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
Pravinsinh
 

Viewers also liked (15)

Selenium Builder
Selenium BuilderSelenium Builder
Selenium Builder
 
Introducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test DevelopmentIntroducing Selenium Builder – the Future of Test Development
Introducing Selenium Builder – the Future of Test Development
 
Selenium Webdriver - jOpenSpace 2015
Selenium Webdriver - jOpenSpace 2015Selenium Webdriver - jOpenSpace 2015
Selenium Webdriver - jOpenSpace 2015
 
Self-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriverSelf-Generating Test Artifacts for Selenium/WebDriver
Self-Generating Test Artifacts for Selenium/WebDriver
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
 
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
Understanding Selenium/RC, Webdriver Architecture and developing the page obj...
 
Selenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applicationsSelenium WebDriver - Test automation for web applications
Selenium WebDriver - Test automation for web applications
 
Java Collections Framework
Java  Collections  FrameworkJava  Collections  Framework
Java Collections Framework
 
Java exception handling ppt
Java exception handling pptJava exception handling ppt
Java exception handling ppt
 
Exception handling
Exception handlingException handling
Exception handling
 
Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Java Exception handling
Java Exception handlingJava Exception handling
Java Exception handling
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Manual testing interview question by INFOTECH
Manual testing interview question by INFOTECHManual testing interview question by INFOTECH
Manual testing interview question by INFOTECH
 

Similar to Selenium intro

Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
Sami Ekblad
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
Rajathi-QA
 
DirectToWeb 2.0
DirectToWeb 2.0DirectToWeb 2.0
DirectToWeb 2.0
WO Community
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Roy de Kleijn
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
drewz lin
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
Ben Hall
 
IE8 Dev Overview_pp2003
IE8 Dev Overview_pp2003IE8 Dev Overview_pp2003
IE8 Dev Overview_pp2003
Wes Yanaga
 
Web driver training
Web driver trainingWeb driver training
Web driver training
Dipesh Bhatewara
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with  seleniumContinuous integration using thucydides(bdd) with  selenium
Continuous integration using thucydides(bdd) with selenium
Khyati Sehgal
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
Quontra Solutions
 
14. html 5 security considerations
14. html 5 security considerations14. html 5 security considerations
14. html 5 security considerations
Eoin Keary
 
Single Page WebApp Architecture
Single Page WebApp ArchitectureSingle Page WebApp Architecture
Single Page WebApp Architecture
Morgan Cheng
 
Webdriver.io
Webdriver.io Webdriver.io
Webdriver.io
LinkMe Srl
 
Java. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax ApplicationsJava. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax Applications
Марія Русин
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumContinuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with selenium
Xebia IT Architects
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
Software Park Thailand
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
Nikita Simonovets
 
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptxTop 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
AnanthReddy38
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
IMC Institute
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Edureka!
 

Similar to Selenium intro (20)

Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Selenium WebDriver
Selenium WebDriverSelenium WebDriver
Selenium WebDriver
 
DirectToWeb 2.0
DirectToWeb 2.0DirectToWeb 2.0
DirectToWeb 2.0
 
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016Improving Your Selenium WebDriver Tests - Belgium testing days_2016
Improving Your Selenium WebDriver Tests - Belgium testing days_2016
 
Top100summit 谷歌-scott-improve your automated web application testing
Top100summit  谷歌-scott-improve your automated web application testingTop100summit  谷歌-scott-improve your automated web application testing
Top100summit 谷歌-scott-improve your automated web application testing
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
IE8 Dev Overview_pp2003
IE8 Dev Overview_pp2003IE8 Dev Overview_pp2003
IE8 Dev Overview_pp2003
 
Web driver training
Web driver trainingWeb driver training
Web driver training
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with  seleniumContinuous integration using thucydides(bdd) with  selenium
Continuous integration using thucydides(bdd) with selenium
 
Automation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra SolutionsAutomation with Selenium Presented by Quontra Solutions
Automation with Selenium Presented by Quontra Solutions
 
14. html 5 security considerations
14. html 5 security considerations14. html 5 security considerations
14. html 5 security considerations
 
Single Page WebApp Architecture
Single Page WebApp ArchitectureSingle Page WebApp Architecture
Single Page WebApp Architecture
 
Webdriver.io
Webdriver.io Webdriver.io
Webdriver.io
 
Java. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax ApplicationsJava. Explicit and Implicit Wait. Testing Ajax Applications
Java. Explicit and Implicit Wait. Testing Ajax Applications
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumContinuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with selenium
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Escape from the automation hell
Escape from the automation hellEscape from the automation hell
Escape from the automation hell
 
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptxTop 15 Selenium WebDriver Interview Questions and Answers.pptx
Top 15 Selenium WebDriver Interview Questions and Answers.pptx
 
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
Selenium WebDriver Tutorial For Beginners | What Is Selenium WebDriver | Sele...
 

Recently uploaded

14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
ShulagnaSarkar2
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
VALiNTRY360
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
dakas1
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
GohKiangHock
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
TaghreedAltamimi
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
mz5nrf0n
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
Karya Keeper
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
Remote DBA Services
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 

Recently uploaded (20)

14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision14 th Edition of International conference on computer vision
14 th Edition of International conference on computer vision
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfTop Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdf
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
一比一原版(UMN毕业证)明尼苏达大学毕业证如何办理
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
SQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure MalaysiaSQL Accounting Software Brochure Malaysia
SQL Accounting Software Brochure Malaysia
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
Lecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptxLecture 2 - software testing SE 412.pptx
Lecture 2 - software testing SE 412.pptx
 
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
在线购买加拿大英属哥伦比亚大学毕业证本科学位证书原版一模一样
 
Project Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdfProject Management: The Role of Project Dashboards.pdf
Project Management: The Role of Project Dashboards.pdf
 
Oracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptxOracle 23c New Features For DBAs and Developers.pptx
Oracle 23c New Features For DBAs and Developers.pptx
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 

Selenium intro

  • 2. Selenium ❖ What is it? ❖ What is it good for? ❖ How do I get started? ❖ What are the gotchas?
  • 3. Selenium? ❖ AKA Webdriver ❖ Web automation/testing framework ❖ Tests run on real browsers
  • 5. Pros ❖ Realistic test conditions ❖ Cross-browser testing ❖ Popular & mature tech
  • 6. Cons ❖ Slow ❖ Changing HTML may break tests
  • 7. Uses ❖ Acceptance Testing ❖ Continuous Integration ❖ Monitoring ❖ TDD? Maybe?
  • 8. Python example from selenium.webdriver.firefox.webdriver import WebDriver wd = WebDriver() wd.implicitly_wait(60) wd.get("http://www.metafilter.com/") wd.find_element_by_link_text("FAQ").click() assert "How do I sign up for a MetaFilter account?" in wd.find_element_by_tag_name("html").text
  • 9. PHP! require_once 'php-webdriver'; $wd = new WebDriver(); $session = $wd->session(); $session->open("http://www.metafilter.com/"); $session->element("link text", "FAQ")->click(); $session->close(); assert(strpos( $session->element("tag name", "html")->text(), "How do I sign up for a MetaFilter account?"));
  • 10. Java! import org.openqa.selenium.*; import static java.util.concurrent.TimeUnit.*; FirefoxDriver wd = new FirefoxDriver(); wd.manage().timeouts().implicitlyWait(60, SECONDS); wd.get("http://www.metafilter.com/"); wd.findElement(By.linkText("FAQ")).click(); assert wd.findElement(By.tagName("html")).getText() .contains("How do I sign up for a MetaFilter account?") wd.quit();
  • 11. Getting started, option A ❖ Get Selenium server from seleniumhq.org ❖ Download language binding of your choice ❖ Write some code & play it back
  • 12. Getting started, option B ➔ Get Selenium Builder from sebuilder.com ➔ Record your actions as tests ➔ Play back locally, or via server ➔ Export to code or JSON ➔ Run JSON via interpreters
  • 13.
  • 14. Gotcha 1: Visibility ❖ Selenium respects display: none ❖ You can’t interact with something invisible ❖ Even if it’s in the HTML
  • 15. Gotcha 2: Timing ❖ Page needs to load first ❖ Some Javascript has to execute too? ❖ Page changes dynamically?
  • 16. Gotcha 2: Timing ❖ Wait for page elements ❖ Implicitly or explicitly ❖ Don’t use pause!
  • 17. Gotcha 2: Timing from selenium.webdriver.firefox.webdriver import WebDriver wd = WebDriver() wd.implicitly_wait(60) wd.get("http://www.metafilter.com/") wd.find_element_by_link_text("FAQ").click() assert "How do I sign up for a MetaFilter account?" in wd.find_element_by_tag_name("html").text
  • 18. Gotcha 3: Locators from selenium.webdriver.firefox.webdriver import WebDriver wd = WebDriver() wd.implicitly_wait(60) wd.get("http://www.metafilter.com/") wd.find_element_by_link_text("FAQ").click() assert "How do I sign up for a MetaFilter account?" in wd.find_element_by_tag_name("html").text
  • 19. Gotcha 3: Locators ❖ Locators identify UI elements ❖ HTML changes can break locators
  • 20. Gotcha 3: Locators ❖ Use simple, clean, robust locators ❖ Depends on your approach ❖ Text vs ID vs CSS ❖ Careful XPATH for the tough cases
  • 21. Good & bad locators id: home_link id: 12094b css: span.green css: #rightbar > .menu > li:nth-of-type(3) > h5 css: .logout xpath: //*[@id='menu']//input[3] xpath: //header/div/div[1]/div[1]/a/h1/span[2]
  • 22. Good & bad locators id: home_link id: 12094b css: span.green css: #rightbar > .menu > li:nth-of-type(3) > h5 css: .logout xpath: //*[@id='menu']//input[3] xpath: //header/div/div[1]/div[1]/a/h1/span[2]
  • 23. Resources ❖ Selenium HQ ❖ A CI solution with Builder, Travis & Sauce ❖ Obligatory self-promotion!