SlideShare a Scribd company logo
Selenium 2
 Jason Huggins
Co-creator, The Selenium Project
Co-founder, CTO, Sauce Labs Inc
         twitter: @hugs
  email: hugs@saucelabs.com
Follow me on Twitter:


@hugs
Get Library from PyPI

$ pip install -U selenium
Agenda

•   Overview of Selenium

    •   Selenium IDE, Builder (new!), RC, Grid

•   Why: Selenium 2

•   What: Selenium 2

•   Demos!
What is Selenium?



  =       +
The Problem
Selenium IDE for Firefox
Builder (new!)
!"#$%"&'$(%)$*




                                         9
                 +%%,-..///01*234)03$#.,+$%$5.23"6$(".789:;8<=:
Selenium Remote Control


                            Selenium RC Server
 Python, Ruby,
                                                               Your Awesome
Java, C#, or Perl    HTTP                        HTTP   HTTP
                                                                 Web App
   Test Script
Example Selenium RC Test - Java
Example Selenium RC Test - C#
!"#$
Selenium Grid




                %&&'())***+,-#./"+.01)'%0&02)$345)678
Servers




          Time


          Unit of Work
Servers




          Time


          Unit of Work
Selenium 2:
 Why and What
Mobile
Types of Mobile Testing

•   Emulator
•   Real device (tethered to workstation)
•   Real device in a real location on a real
    network
Native vs Web
Life before the Web




Total Application Market
Yesterday



              JS+HTML




Total Application Market
Today



              JS+HTML5




Total Application Market
Data?
Selenium 2 - PyCon 2011
Sencha
SproutCore
PhoneGap
Today
                            Selenium
                           lives here!

              JS+HTML5




Total Application Market
Selenium 2 - PyCon 2011
Today
                            Selenium
                           lives here!

              JS+HTML5




Total Application Market
Tomorrow
                            Selenium
                           lives here!




      JS+HTML5




Total Application Market
The Pareto Principle
AKA (“The Pacman Problem”)


          Selenium 1



                       Selenium 2
Solving the last 20%
• Native keyboard & mouse events
• Same Origin Policy / XSS / HTTP(S)
• Pop-ups, dialogs
  – Basic Authentication
  – Self-signed certi cates
  – File upload/download
Selenium 2 - PyCon 2011
Cleaner API
• WebDriver Object




• WebElement Objects
Other Bene ts
• Improved architecture
• Removing road-blocks, hacks, and workarounds
• Scales down (more developer friendly) experience
Selenium Remote Control


                            Selenium RC Server
 Python, Ruby,
                                                               Your Awesome
Java, C#, or Perl    HTTP                        HTTP   HTTP
                                                                 Web App
   Test Script
Selenium 2


                           Selenium RC Server
 Python, Ruby,
                                                              Your Awesome
Java, C#, or Perl   HTTP                        HTTP   HTTP
                                                                Web App
   Test Script
Python, Ruby,
                                  Your Awesome
Java, C#, or Perl   HTTP   HTTP
                                    Web App
   Test Script
Python, Ruby,
                                   Your Awesome
Java, C#, or Perl   C/C++   HTTP
                                     Web App
   Test Script
Running a server is now optional!


                           Selenium Grid
 Python, Ruby,
                                                         Your Awesome
Java, C#, or Perl   HTTP                   HTTP   HTTP
                                                           Web App
   Test Script
Mobile - How?
Checkout Selenium
Android
Download Android SDK
Unpack

~/android_sdk
Update

$ cd ~/android_sdk/tools
$ ./android update sdk
Create AVD

$ ./android create avd 
            -n my_android 
            -t 8 
            -c 100M
Start Emulator

$ ./emulator -avd my_android 
             -no-audio 
             -no-boot-anim 
             -scale .8 &
Install Selenium APK

$ cd ~/android_sdk/platform-tools/
$ ./adb -e install 
        -r ~/selenium/android/prebuilt/android-server.apk
Port Forwarding

$ ./adb forward tcp:8080 tcp:8080
(One More Step)

 Launch WebDriver App
iPhone
Open in XCode

$ open ~/selenium/iphone/iWebDriver.xcodeproj/
Build & Run
Demo!
The Code:
# Import the Selenium 2 namespace (aka "webdriver")
from selenium import webdriver

# Run one of the four following commands:

# iPhone
driver = webdriver.Remote(browser_name="iphone",
                          command_executor='http://172.24.101.36:3001/hub')

# Android
driver = webdriver.Remote(browser_name="android",
                          command_executor='http://127.0.0.1:8080/hub')

# Google Chrome
driver = webdriver.Chrome()

# Firefox
driver = webdriver.Firefox()
The Code:
# The actual test scenario: Test the codepad.org code execution service.

# Go to codepad.org
driver.get('http://codepad.org')

# Select the Python language option
python_link = driver.find_elements_by_xpath("//input[@name='lang' and @value='Python']")
[0]
python_link.click()

# Enter some text!
text_area = driver.find_element_by_id('textarea')
text_area.send_keys("print 'Hello,' + ' World!'")

# Submit the form!
submit_button = driver.find_element_by_name('submit')
submit_button.click()

# Make this an actual test. Isn't Python beautiful?
assert "Hello, World!" in driver.get_page_source()

# Close the browser!
driver.quit()
Selenium 2 - The Movie
 http://www.youtube.com/watch?v=IUUcEIfkOEY
Links
For More Information:
✓http://seleniumhq.org
✓http://code.google.com/p/selenium
✓http://code.google.com/p/se-builder/
✓http://saucelabs.com/docs/selenium2
✓http://twitter.com/hugs
Slides:
✓http://www.slideshare.net/hugs/se2pycon
Demo Screencast:
✓http://www.youtube.com/watch?v=IUUcEIfkOEY
Code:
✓http://gist.github.com/830011
Thanks!
 Jason Huggins
Co-creator, The Selenium Project
Co-founder, CTO, Sauce Labs Inc
         twitter: @hugs
  email: hugs@saucelabs.com

More Related Content

PPT
Selenium
PPT
Selenium
PPTX
Automation - web testing with selenium
PDF
Selenium webdriver interview questions and answers
PDF
Selenium Tips & Tricks
PDF
Practical Tips & Tricks for Selenium Test Automation - Dave Haeffner
PPT
Selenium Primer
PDF
Basics of Selenium IDE,Core, Remote Control
Selenium
Selenium
Automation - web testing with selenium
Selenium webdriver interview questions and answers
Selenium Tips & Tricks
Practical Tips & Tricks for Selenium Test Automation - Dave Haeffner
Selenium Primer
Basics of Selenium IDE,Core, Remote Control

What's hot (20)

PPT
Selenium
PDF
Practical Tips & Tricks for Selenium Test Automation
PPT
Introduction to Selenium
PPT
Web Test Automation with Selenium
PPT
Selenium Concepts
DOCX
Selenium WebDriver FAQ's
PPT
Selenium
PPTX
Selenium WebDriver training
ODP
Mastering selenium for automated acceptance tests
DOCX
Selenium webdriver course content rakesh hansalia
PPTX
Introduction to Selenium Web Driver
PPTX
Introduction to selenium
PDF
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
PDF
Selenium Best Practices with Jason Huggins
PPTX
Automation Testing by Selenium Web Driver
PPTX
Test Automation and Selenium
PDF
Selenium web driver
PPTX
Selenium Webdriver
PPT
Selenium Primer
PDF
Selenium Basics Tutorial
Selenium
Practical Tips & Tricks for Selenium Test Automation
Introduction to Selenium
Web Test Automation with Selenium
Selenium Concepts
Selenium WebDriver FAQ's
Selenium
Selenium WebDriver training
Mastering selenium for automated acceptance tests
Selenium webdriver course content rakesh hansalia
Introduction to Selenium Web Driver
Introduction to selenium
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Best Practices with Jason Huggins
Automation Testing by Selenium Web Driver
Test Automation and Selenium
Selenium web driver
Selenium Webdriver
Selenium Primer
Selenium Basics Tutorial
Ad

Viewers also liked (18)

PPTX
Selenium web driver
PDF
Selenium, Appium, and Robots!
DOCX
A Case Study of Using Selenium IDE and WebDriver_Word Doc
PDF
Concurrency and Multithreading Demistified - Reversim Summit 2014
PPTX
Browser Automated Testing Frameworks - Nightwatch.js
PPTX
PPTX
PPTX
Maven and ANT
PPTX
Path Testing
PPTX
Comparison of Sweden and EU data
PDF
Manual Pegaso Expander Esp2
RTF
Packers And Movers In Kolkata
PDF
English summer camp_2011_llamado[1]
PPTX
Avestruz
PPTX
Endeavor rosario 120627
PPT
Web 2.0: Making Email a Useful Web App
PDF
I Jornada Gastronómica Orihuela Costa 2011
Selenium web driver
Selenium, Appium, and Robots!
A Case Study of Using Selenium IDE and WebDriver_Word Doc
Concurrency and Multithreading Demistified - Reversim Summit 2014
Browser Automated Testing Frameworks - Nightwatch.js
Maven and ANT
Path Testing
Comparison of Sweden and EU data
Manual Pegaso Expander Esp2
Packers And Movers In Kolkata
English summer camp_2011_llamado[1]
Avestruz
Endeavor rosario 120627
Web 2.0: Making Email a Useful Web App
I Jornada Gastronómica Orihuela Costa 2011
Ad

Similar to Selenium 2 - PyCon 2011 (20)

KEY
Selenium at STPCon - Dallas 2011
PDF
selenium-2-mobile-web-testing
PDF
Mobile Testing with Selenium 2 by Jason Huggins
PDF
Browser-level testing
PPTX
Selenium – testing tool jack
PPTX
PPT
Selenium
PPT
Testing Web Apps With Scripting Language - Mark Rees, Century Software
PDF
Selenium camp v1
DOC
Selenium Automation Using Ruby
PPTX
Test Automation Using Selenium
PPT
QSpiders - Automation using Selenium
PDF
New Generation Record/Playback Tools for AJAX Testing
PDF
Selenium RC - Web Application Testing Tool
KEY
Getting started with Selenium 2
PPTX
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
PPTX
test-automation-selenium-160216124839.pptx
PPTX
Selenium- A Software Testing Tool
PPTX
تست وب اپ ها با سلنیوم - علیرضا عظیم زاده میلانی
PPTX
Step by step instructions to execute selenium automation testing
Selenium at STPCon - Dallas 2011
selenium-2-mobile-web-testing
Mobile Testing with Selenium 2 by Jason Huggins
Browser-level testing
Selenium – testing tool jack
Selenium
Testing Web Apps With Scripting Language - Mark Rees, Century Software
Selenium camp v1
Selenium Automation Using Ruby
Test Automation Using Selenium
QSpiders - Automation using Selenium
New Generation Record/Playback Tools for AJAX Testing
Selenium RC - Web Application Testing Tool
Getting started with Selenium 2
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
test-automation-selenium-160216124839.pptx
Selenium- A Software Testing Tool
تست وب اپ ها با سلنیوم - علیرضا عظیم زاده میلانی
Step by step instructions to execute selenium automation testing

More from hugs (10)

PDF
Selenium Conf - Robots
PPTX
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
PDF
PinThing
PDF
The Secret Sauce in the Open Cloud
PDF
Selenium and Sauce Labs
PDF
Orbison Orb - Pycon 2010
PDF
Node.js - JavaScript Chicago Meetup
PDF
WTFV is the new RTFM
PDF
The Future Of Web App Testing and How To Stop It
PDF
Hacking Selenium @ JSConf
Selenium Conf - Robots
Extreme Testing with Selenium - @hugs at Jenkins User Conference 2011
PinThing
The Secret Sauce in the Open Cloud
Selenium and Sauce Labs
Orbison Orb - Pycon 2010
Node.js - JavaScript Chicago Meetup
WTFV is the new RTFM
The Future Of Web App Testing and How To Stop It
Hacking Selenium @ JSConf

Recently uploaded (20)

PPTX
Cloud computing and distributed systems.
PDF
Encapsulation theory and applications.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Modernizing your data center with Dell and AMD
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Cloud computing and distributed systems.
Encapsulation theory and applications.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
Modernizing your data center with Dell and AMD
Chapter 3 Spatial Domain Image Processing.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Dropbox Q2 2025 Financial Results & Investor Presentation
NewMind AI Monthly Chronicles - July 2025
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Digital-Transformation-Roadmap-for-Companies.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...

Selenium 2 - PyCon 2011