SlideShare una empresa de Scribd logo
1 de 13
UI Testing with Splinter
Taizo Ito <taizo.ito@hde.co.jp>
HDE, Inc.
What’s Splinter?
UI Testing tool for web applications
- Open source software (BSD-like License)
- Implemented by Python
As of this writing, there seems to be no other python-implemented tools like this.
- It helps you control actions on web browser
Features
- Easy to install/setup
- Support popular browsers
- Easy to use
Simple and intuitive API
Installation
Simply run the following command. That’s all!
$ sudo pip install splinter
As an additional requirement, a web client such as
Chrome, Firefox and PhantomJS must be installed.
Supported Browsers
Splinter provides multiple web drivers:
Browser based
Chrome, Firefox, (Remote)
Headless
PhantomJS, zope.testbrowser, django client, Flask client
Remote
Uses Selenium RC to automate browser actions on a remote machine such as
Sauce Labs.
Web
Driver
Splinter is an abstraction layer
The same test code covers actions of any browser
A
P
I
Browser-based
Selenium
Headless
PhantomJS
zope.testbrowser
Chrome
Firefox
RemoteTest
Code
Remote
Webdriver Server
Sauce Labs (IE)
HTTP
Splinter
APIs
Each method is so intuitive; It’s easy to use.
- visit()
Go to the specified URL. e.g. browser.visit(‘http://www.hde.co.jp’) # then you can see html text from
browser.html.
- fill()
Fill an input form with the specified text. e.g. browser.find_by_id(‘your_name’).fill(‘taizo’)
- click()
Click an element such as button or link text. e.g. browser.find_by_id(‘search_button’).click()
and more…
Example: Login with Single Sign On(1)
Login to App using Google Apps Federated Login
1 browser = Browser(“phantomjs”)
2
3 browser.visit(“https://foobar.example.com/login”)
4
5 browser.find_by_id(“Email”).fill(“foobar@example.com”)
6 browser.find_by_id(“Passwd”).fill(“secret_password”)
7 browser.find_by_id(“signIn”).click()
8 time.sleep(1)
9
10 if browser.title == “Request for Permission”:
11 browser.find_by_id(“submit_approve_access”).click()
12 time.sleep(1)
13
14 assert browser.title == “This is a title of App”, “Failed to login”
Example: Login with Single Sign On(2)
Login to App using Microsoft WAAD SAML
1 browser = Browser(“phantomjs”)
2
3 browser.visit(“https://foobar.example.com/login”)
4
5 browser.find_by_id(“cred_userid_inputtext”).fill(“foobar@example.com”)
6 browser.find_by_id(“cred_password_inputtext”).fill(“secret_password”)
7 browser.find_by_id(“cred_keep_me_signed_in_checkbox”).check()
8 time.sleep(1)
9 browser.find_by_id(“cred_sign_in_button”).click()
10 time.sleep(1)
11
12 assert browser.title == “This is a title of App”, “Failed to login”
Other features
Cookie Manager
● browser.cookies.all()
● browser.cookies.add()
● browser.cookies.delete()
Features not implemented
We are not allowed to:
- Get contents of downloaded data by using Splinter.
We have to use requests module to get it instead of Splinter.
- Customize HTTP Request headers when using headless web driver.
Therefore, we can’t check if the multi-language feature of web apps works well.
Accept-Language: en-US,en;q=0.8,ja;q=0.6
Tips
- Use Google Chrome’s Developer Console to get the
XPath of an element.
It is easy to identify the element using find_by_xpath().
- To customize HTTP Request headers in PhantomJS
driver,
get the latest vesion from Github, which supports custom headers.
My PR was accepted ;-) https://github.com/cobrateam/splinter/pull/316
- Use Splinter with behave. http://pythonhosted.org/behave/
You can easily practice BDD(Behavior-Driven Development) for web apps with Python.
Thank you
Taizo Ito <taizo.ito@hde.co.jp>
HDE, Inc.

Más contenido relacionado

La actualidad más candente

Selenium Ide Tutorials
Selenium Ide TutorialsSelenium Ide Tutorials
Selenium Ide Tutorials
gueste1e4db
 

La actualidad más candente (8)

PHP: Debugger, Profiler and more
PHP: Debugger, Profiler and morePHP: Debugger, Profiler and more
PHP: Debugger, Profiler and more
 
Browser extension
Browser extensionBrowser extension
Browser extension
 
A Complete Guide To Chrome Extension Development
A Complete Guide  To Chrome Extension  DevelopmentA Complete Guide  To Chrome Extension  Development
A Complete Guide To Chrome Extension Development
 
Firefox Extension Development
Firefox Extension DevelopmentFirefox Extension Development
Firefox Extension Development
 
Selenium Open Source Tool
Selenium Open Source ToolSelenium Open Source Tool
Selenium Open Source Tool
 
Selenium Ide Tutorials
Selenium Ide TutorialsSelenium Ide Tutorials
Selenium Ide Tutorials
 
Banquet 42
Banquet 42Banquet 42
Banquet 42
 
What The Flask? and how to use it with some Google APIs
What The Flask? and how to use it with some Google APIsWhat The Flask? and how to use it with some Google APIs
What The Flask? and how to use it with some Google APIs
 

Destacado

Jun.27 fukutomi
Jun.27 fukutomiJun.27 fukutomi
Jun.27 fukutomi
iyo16
 
Studying Abroad in Cebu
Studying Abroad in CebuStudying Abroad in Cebu
Studying Abroad in Cebu
etgjsv
 
First impressions of Go
First impressions of GoFirst impressions of Go
First impressions of Go
Yusaku OGAWA
 
Implementation of gui framework part1
Implementation of gui framework part1Implementation of gui framework part1
Implementation of gui framework part1
masahiroookubo
 
Garbled text in email
Garbled text in emailGarbled text in email
Garbled text in email
tas-hiro
 
The language barrier.
The language barrier.The language barrier.
The language barrier.
pumpkin_brownies
 

Destacado (20)

How to study english
How to study englishHow to study english
How to study english
 
Jun.27 fukutomi
Jun.27 fukutomiJun.27 fukutomi
Jun.27 fukutomi
 
Studying Abroad in Cebu
Studying Abroad in CebuStudying Abroad in Cebu
Studying Abroad in Cebu
 
DockerCon 14
DockerCon 14DockerCon 14
DockerCon 14
 
First impressions of Go
First impressions of GoFirst impressions of Go
First impressions of Go
 
Implementation of gui framework part1
Implementation of gui framework part1Implementation of gui framework part1
Implementation of gui framework part1
 
Implementation of gui framework part2
Implementation of gui framework part2Implementation of gui framework part2
Implementation of gui framework part2
 
A brief introduction to CentOS 7
A brief introduction to CentOS 7A brief introduction to CentOS 7
A brief introduction to CentOS 7
 
Overview pcidss
Overview pcidssOverview pcidss
Overview pcidss
 
Implementation of GUI Framework part3
Implementation of GUI Framework part3Implementation of GUI Framework part3
Implementation of GUI Framework part3
 
Hello pivotal tracker
Hello pivotal trackerHello pivotal tracker
Hello pivotal tracker
 
Introducing chrome apps (ogura)
Introducing chrome apps (ogura)Introducing chrome apps (ogura)
Introducing chrome apps (ogura)
 
Do not rm_log_files
Do not rm_log_filesDo not rm_log_files
Do not rm_log_files
 
Introduction to bioinformatics
Introduction to bioinformaticsIntroduction to bioinformatics
Introduction to bioinformatics
 
Implement server push in flask framework
Implement server push in flask frameworkImplement server push in flask framework
Implement server push in flask framework
 
Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemd
 
Garbled text in email
Garbled text in emailGarbled text in email
Garbled text in email
 
AWS Cost Visualizer
AWS Cost VisualizerAWS Cost Visualizer
AWS Cost Visualizer
 
The language barrier.
The language barrier.The language barrier.
The language barrier.
 
Authentication
AuthenticationAuthentication
Authentication
 

Similar a Ui testing with splinter - Fri, 30 May 2014

Firefox OS Introduction at Bontouch
Firefox OS Introduction at BontouchFirefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Robert Nyman
 
Mozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open WebMozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open Web
Robert Nyman
 

Similar a Ui testing with splinter - Fri, 30 May 2014 (20)

Detecting headless browsers
Detecting headless browsersDetecting headless browsers
Detecting headless browsers
 
Setting UIAutomation free with Appium
Setting UIAutomation free with AppiumSetting UIAutomation free with Appium
Setting UIAutomation free with Appium
 
Introduction to python scrapping
Introduction to python scrappingIntroduction to python scrapping
Introduction to python scrapping
 
Web testing with Selenium
Web testing with SeleniumWeb testing with Selenium
Web testing with Selenium
 
Browser-level testing
Browser-level testingBrowser-level testing
Browser-level testing
 
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
QA Fest 2014. Ярослав Пернеровский. Appium - два в одном. рецепт приготовлени...
 
Setting Apple's UI Automation Free with Appium
Setting Apple's UI Automation Free with AppiumSetting Apple's UI Automation Free with Appium
Setting Apple's UI Automation Free with Appium
 
Firefox OS Introduction at Bontouch
Firefox OS Introduction at BontouchFirefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
 
Mozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open WebMozilla, Firefox OS and the Open Web
Mozilla, Firefox OS and the Open Web
 
Play framework
Play frameworkPlay framework
Play framework
 
PHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source ProjectPHP SA 2014 - Releasing Your Open Source Project
PHP SA 2014 - Releasing Your Open Source Project
 
LvivPy - Flask in details
LvivPy - Flask in detailsLvivPy - Flask in details
LvivPy - Flask in details
 
Appium
AppiumAppium
Appium
 
OWASP Zed Attack Proxy
OWASP Zed Attack ProxyOWASP Zed Attack Proxy
OWASP Zed Attack Proxy
 
Whys and Hows of Automation
Whys and Hows of AutomationWhys and Hows of Automation
Whys and Hows of Automation
 
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
JavaOne2016 #CON5929 Time-Saving Tips and Tricks for Building Quality Java Ap...
 
Take control. write a plugin. part II
Take control. write a plugin. part IITake control. write a plugin. part II
Take control. write a plugin. part II
 
Intro to Selenium UI Tests with pytest & some useful pytest plugins
Intro to Selenium UI Tests with pytest & some useful pytest pluginsIntro to Selenium UI Tests with pytest & some useful pytest plugins
Intro to Selenium UI Tests with pytest & some useful pytest plugins
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 
Front-End Testing: Demystified
Front-End Testing: DemystifiedFront-End Testing: Demystified
Front-End Testing: Demystified
 

Último

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 

Último (20)

Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 

Ui testing with splinter - Fri, 30 May 2014

  • 1. UI Testing with Splinter Taizo Ito <taizo.ito@hde.co.jp> HDE, Inc.
  • 2. What’s Splinter? UI Testing tool for web applications - Open source software (BSD-like License) - Implemented by Python As of this writing, there seems to be no other python-implemented tools like this. - It helps you control actions on web browser
  • 3. Features - Easy to install/setup - Support popular browsers - Easy to use Simple and intuitive API
  • 4. Installation Simply run the following command. That’s all! $ sudo pip install splinter As an additional requirement, a web client such as Chrome, Firefox and PhantomJS must be installed.
  • 5. Supported Browsers Splinter provides multiple web drivers: Browser based Chrome, Firefox, (Remote) Headless PhantomJS, zope.testbrowser, django client, Flask client Remote Uses Selenium RC to automate browser actions on a remote machine such as Sauce Labs.
  • 6. Web Driver Splinter is an abstraction layer The same test code covers actions of any browser A P I Browser-based Selenium Headless PhantomJS zope.testbrowser Chrome Firefox RemoteTest Code Remote Webdriver Server Sauce Labs (IE) HTTP Splinter
  • 7. APIs Each method is so intuitive; It’s easy to use. - visit() Go to the specified URL. e.g. browser.visit(‘http://www.hde.co.jp’) # then you can see html text from browser.html. - fill() Fill an input form with the specified text. e.g. browser.find_by_id(‘your_name’).fill(‘taizo’) - click() Click an element such as button or link text. e.g. browser.find_by_id(‘search_button’).click() and more…
  • 8. Example: Login with Single Sign On(1) Login to App using Google Apps Federated Login 1 browser = Browser(“phantomjs”) 2 3 browser.visit(“https://foobar.example.com/login”) 4 5 browser.find_by_id(“Email”).fill(“foobar@example.com”) 6 browser.find_by_id(“Passwd”).fill(“secret_password”) 7 browser.find_by_id(“signIn”).click() 8 time.sleep(1) 9 10 if browser.title == “Request for Permission”: 11 browser.find_by_id(“submit_approve_access”).click() 12 time.sleep(1) 13 14 assert browser.title == “This is a title of App”, “Failed to login”
  • 9. Example: Login with Single Sign On(2) Login to App using Microsoft WAAD SAML 1 browser = Browser(“phantomjs”) 2 3 browser.visit(“https://foobar.example.com/login”) 4 5 browser.find_by_id(“cred_userid_inputtext”).fill(“foobar@example.com”) 6 browser.find_by_id(“cred_password_inputtext”).fill(“secret_password”) 7 browser.find_by_id(“cred_keep_me_signed_in_checkbox”).check() 8 time.sleep(1) 9 browser.find_by_id(“cred_sign_in_button”).click() 10 time.sleep(1) 11 12 assert browser.title == “This is a title of App”, “Failed to login”
  • 10. Other features Cookie Manager ● browser.cookies.all() ● browser.cookies.add() ● browser.cookies.delete()
  • 11. Features not implemented We are not allowed to: - Get contents of downloaded data by using Splinter. We have to use requests module to get it instead of Splinter. - Customize HTTP Request headers when using headless web driver. Therefore, we can’t check if the multi-language feature of web apps works well. Accept-Language: en-US,en;q=0.8,ja;q=0.6
  • 12. Tips - Use Google Chrome’s Developer Console to get the XPath of an element. It is easy to identify the element using find_by_xpath(). - To customize HTTP Request headers in PhantomJS driver, get the latest vesion from Github, which supports custom headers. My PR was accepted ;-) https://github.com/cobrateam/splinter/pull/316 - Use Splinter with behave. http://pythonhosted.org/behave/ You can easily practice BDD(Behavior-Driven Development) for web apps with Python.
  • 13. Thank you Taizo Ito <taizo.ito@hde.co.jp> HDE, Inc.