SlideShare a Scribd company logo
1 of 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.

More Related Content

What's hot

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

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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 to 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 to 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
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next IntegrationWSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
WSO2CON2024 - Why Should You Consider Ballerina for Your Next Integration
 
WSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in UgandaWSO2CON 2024 - Building a Digital Government in Uganda
WSO2CON 2024 - Building a Digital Government in Uganda
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
WSO2CON 2024 - IoT Needs CIAM: The Importance of Centralized IAM in a Growing...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
WSO2CON 2024 - Lessons from the Field: Legacy Platforms – It's Time to Let Go...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
WSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration ToolingWSO2Con2024 - Low-Code Integration Tooling
WSO2Con2024 - Low-Code Integration Tooling
 
WSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - KanchanaWSO2Con2024 - Hello Choreo Presentation - Kanchana
WSO2Con2024 - Hello Choreo Presentation - Kanchana
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2Driving Innovation: Scania's API Revolution with WSO2
Driving Innovation: Scania's API Revolution with WSO2
 
%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
 
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
WSO2CON 2024 - Unlocking the Identity: Embracing CIAM 2.0 for a Competitive A...
 
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
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

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.