SlideShare a Scribd company logo
Selenium Grid
       Kevin Menard
 Maintainer, Selenium Grid
    Founder, Mogotest
What is Selenium Grid?



• Maintain a cluster of Selenium RC servers
• Configure tests for different environments
• Parallelize your tests
How Does it Work?

Selenium Grid Hub      Selenium Grid Node   Selenium RC Server



                       Selenium Grid Node   Selenium RC Server

                       host_a


     Client
      Client           Selenium Grid Node   Selenium RC Server
       Client
        Client

                       host_b
How Does it Work?

Selenium Grid Hub      Selenium Grid Node   Selenium RC Server



                       Selenium Grid Node   Selenium RC Server

                       host_a


     Client
      Client           Selenium Grid Node   Selenium RC Server
       Client
        Client

                       host_b
How Does it Work?

Selenium Grid Hub      Selenium Grid Node   Selenium RC Server



                       Selenium Grid Node   Selenium RC Server

                       host_a


     Client
      Client           Selenium Grid Node   Selenium RC Server
       Client
        Client

                       host_b
Environments

    • Map descriptive names to browser strings
    • Configured in Selenium Grid Hub

hub:
  environments:
     - name:    "linux_firefox_3_6"
       browser: "*firefox /opt/firefox-3.6/firefox-bin"
     - name:    "windows_firefox_3_5"
       browser: "*firefox"
     - name:    "windows_firefox_3_6"
       browser: "*firefox"
Starting the Hub

   • Edit grid_configuration.yml

Rake:
 $ rake hub:start
 $ BACKGROUND=true nohup rake hub:start &>/dev/null



ant:
 $ ant launch-hub
 $ nohup ant launch-hub >> log_file 2>&1
Selenium Grid Console
• Open http://localhost:4444/console
Starting Up a Node
Rake:
 $ rake rc:start
 $ DISPLAY=:99.0 BACKGROUND=true HOST=host_b PORT=5000
 ENVIRONMENT=linux_firefox_3_6 HUB_URL='http://hub_host:4444'
 SELENIUM_ARGS='-ensureCleanSession -noBrowserSessionReuse'
 nohup rake rc:start &>/dev/null



ant:
 $ ant launch-remote-control
 $ DISPLAY=:99.0 nohup ant -Dhost=host_b -Dport=5000
 -Denvironment=linux_firefox_3_6 -DhubURL='http://hub_host:4444'
 -DseleniumArgs='-ensureCleanSession -noBrowserSessionReuse'
 launch-remote-control >> log_file 2>&1
Node Registration
                     1. Node connects to hub
Selenium Grid Node                                        Selenium Grid Hub
                       environment   windows_firefox_3_6
                          host             host_b
                          port             5000
Node Registration
                     1. Node connects to hub
Selenium Grid Node                                            Selenium Grid Hub
                        environment   windows_firefox_3_6
                           host             host_b
                           port             5000




        2. Hub adds node to environment queue
      windows_chrome                                 windows_firefox_3_6
          host_c:5000                                      host_a:5000

      linux_firefox_3_6                                     host_a:5001

          host_d:5000                                      host_b:5000
Available Node in
     Console
Client Connection

• Client connects with environment name as
  browser string
• Hub looks up by environment & reserves a
  node
  • Blocks until one is available
• Client communicates with hub at all times
  • Hub forwards traffic to correct node
Client Connection Code

Old:                                    New:

require 'rubygems'                      require 'rubygems'
require 'selenium/client'               require 'selenium/client'

browser =                               browser =
  Selenium::Client::Driver.new           Selenium::Client::Driver.new 
    :host => 'localhost',                   :host => 'localhost',
    :port => 4444,                          :port => 4444,
    :browser => '*firefox',                 :browser => 'linux_firefox_3_6',
    :url => 'http://mogotest.com/'          :url => 'http://mogotest.com/'

browser.start_new_browser_session       browser.start_new_browser_session
browser.open 'http://mogotest.com/'     browser.open 'http://mogotest.com/'
browser.close_current_browser_session   browser.close_current_browser_session
Makes Testing Simpler


• Client always connects to known
  endpoint
• Hub takes care of browser allocation
• Nodes can be added dynamically
• Hub handles bad nodes
Grid Resiliency


• Hub can send heartbeat requests to node to
  tell if it has gone down
• Hub can gracefully kill idle sessions
• Hub can kill sessions that take too long to
  create
Parallel Testing

• Need a way to execute in parallel
  • Java: TestNG or parallel-jUnit
  • Ruby: DeepTest
  • Python: nose
• Need a way to parameterize your tests for
  each node’s environment
• Your tests must maintain their own state
Shortcomings

• Selenium 1 API compatible only
  • Using an old version of Selenium RC at that
• 1 request per RC
  • Doesn’t scale vertically very well
• Historically has had multi-threaded problems
  • Fixed as of 1.0.8
Selenium Grid’s Future


• Combine Selenium Grid & RC
  • De facto single-node grid
  • Grid available out of the box
• Auto-discovery of other nodes on network
Selenium Grid 2.0

• Proposal on dev list for new grid 2.0
• Project rewrite by François Reynaud
• Supports Selenium 1 & 2 APIs
• Nicer Web interface
• Very extensible with callback points &
  listeners
Selenium Grid 2.0
        Listeners


• Possible uses
 • Priority queue for test execution
 • Stat tracking
 • OS environment preparation
Conclusion

• Selenium Grid is alive and well
 • 4 releases in the last 9 months
• Pushing towards a Selenium 2
  compatible grid
• If you have time, please review the
  proposed new grid code
Resources
Resources

• Project:
  • Source: http://github.com/nirvdrum/selenium-grid
  • Issues: http://selenium.googlecode.com/
  • Blog: http://seleniumhq.wordpress.com/

• Personal:
  • Twitter: @nirvdrum
  • Email: kevin@mogotest.com

More Related Content

What's hot (20)

PPTX
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
PPT
Automated Web Testing Using Selenium
Weifeng Zhang
 
PPTX
Selenium- A Software Testing Tool
Zeba Tahseen
 
PPT
Selenium Automation Framework
Mindfire Solutions
 
PPTX
Selenium-4
Manoj Kumar Kumar
 
PPT
Selenium ppt
Naga Dinesh
 
PPTX
Python selenium
Ducat
 
PPT
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
PPTX
An overview of selenium webdriver
Anuraj S.L
 
PPTX
Introduction to Selenium Web Driver
Return on Intelligence
 
PDF
Functional Tests Automation with Robot Framework
laurent bristiel
 
PDF
Automation Testing using Selenium
Naresh Chintalcheru
 
PDF
Selenium
eduquer
 
PDF
Test Automation
rockoder
 
PPTX
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
PPTX
Test automation
Xavier Yin
 
PPTX
Automation - web testing with selenium
Tzirla Rozental
 
PDF
Selenium IDE LOCATORS
Mindfire Solutions
 
PPTX
Test automation proposal
Mihai-Cristian Fratila
 
DOCX
Selenium WebDriver FAQ's
Praveen Gorantla
 
Selenium WebDriver training
Vijay Krishnan Ramaswamy
 
Automated Web Testing Using Selenium
Weifeng Zhang
 
Selenium- A Software Testing Tool
Zeba Tahseen
 
Selenium Automation Framework
Mindfire Solutions
 
Selenium-4
Manoj Kumar Kumar
 
Selenium ppt
Naga Dinesh
 
Python selenium
Ducat
 
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 
An overview of selenium webdriver
Anuraj S.L
 
Introduction to Selenium Web Driver
Return on Intelligence
 
Functional Tests Automation with Robot Framework
laurent bristiel
 
Automation Testing using Selenium
Naresh Chintalcheru
 
Selenium
eduquer
 
Test Automation
rockoder
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
Test automation
Xavier Yin
 
Automation - web testing with selenium
Tzirla Rozental
 
Selenium IDE LOCATORS
Mindfire Solutions
 
Test automation proposal
Mihai-Cristian Fratila
 
Selenium WebDriver FAQ's
Praveen Gorantla
 

Similar to Selenium Grid (20)

PDF
Selenium grid workshop london 2016
Marcus Merrell
 
PDF
Introduction to selenium_grid_workshop
seleniumconf
 
PDF
Meet the Selenium Grid
Alexey Nikolaenko
 
ODP
Mastering selenium for automated acceptance tests
Nick Belhomme
 
PDF
Testing world selenium_start_chapter1 (1)
Testing World
 
PDF
Cross Browser Testing using Selenium GRID.pdf
SGBSeo
 
PDF
Cross Browser Testing using Selenium GRID
seo18
 
PDF
How to use Selenium Grid for Multi-Browser Testing.pdf
pcloudy2
 
PPTX
SKILLWISE_SELENIUM
Skillwise Consulting
 
KEY
Getting started with Selenium 2
Sebastiano Armeli
 
PDF
Selenium_Grid
Mithilesh Singh
 
PPT
Running Selenium tests on CI server
Aleksandr Zhuikov
 
PPTX
How to work with Selenium Grid and Cloud Solutions
Noam Zakai
 
PDF
The Selenium Grid: Run Multiple Automated Tests in Parallel
Josiah Renaudin
 
PPTX
How to work with Selenium Grid: a quick walkthrough
Noam Zakai
 
PPTX
Scaling and Managing Selenium Grid
dimakovalenko
 
PPTX
Selenium
Mayuresh Wadekar
 
PDF
Grid Router – scalable and fault tolerant solution for Selenium grid
Mikhail Levin
 
PPTX
Selenium practical
Ruslan Strazhnyk
 
PPTX
Cross platform browser automation tests sdp
Oren Ashkenazy
 
Selenium grid workshop london 2016
Marcus Merrell
 
Introduction to selenium_grid_workshop
seleniumconf
 
Meet the Selenium Grid
Alexey Nikolaenko
 
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Testing world selenium_start_chapter1 (1)
Testing World
 
Cross Browser Testing using Selenium GRID.pdf
SGBSeo
 
Cross Browser Testing using Selenium GRID
seo18
 
How to use Selenium Grid for Multi-Browser Testing.pdf
pcloudy2
 
SKILLWISE_SELENIUM
Skillwise Consulting
 
Getting started with Selenium 2
Sebastiano Armeli
 
Selenium_Grid
Mithilesh Singh
 
Running Selenium tests on CI server
Aleksandr Zhuikov
 
How to work with Selenium Grid and Cloud Solutions
Noam Zakai
 
The Selenium Grid: Run Multiple Automated Tests in Parallel
Josiah Renaudin
 
How to work with Selenium Grid: a quick walkthrough
Noam Zakai
 
Scaling and Managing Selenium Grid
dimakovalenko
 
Grid Router – scalable and fault tolerant solution for Selenium grid
Mikhail Levin
 
Selenium practical
Ruslan Strazhnyk
 
Cross platform browser automation tests sdp
Oren Ashkenazy
 
Ad

Recently uploaded (20)

PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Biography of Daniel Podor.pdf
Daniel Podor
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Ad

Selenium Grid

  • 1. Selenium Grid Kevin Menard Maintainer, Selenium Grid Founder, Mogotest
  • 2. What is Selenium Grid? • Maintain a cluster of Selenium RC servers • Configure tests for different environments • Parallelize your tests
  • 3. How Does it Work? Selenium Grid Hub Selenium Grid Node Selenium RC Server Selenium Grid Node Selenium RC Server host_a Client Client Selenium Grid Node Selenium RC Server Client Client host_b
  • 4. How Does it Work? Selenium Grid Hub Selenium Grid Node Selenium RC Server Selenium Grid Node Selenium RC Server host_a Client Client Selenium Grid Node Selenium RC Server Client Client host_b
  • 5. How Does it Work? Selenium Grid Hub Selenium Grid Node Selenium RC Server Selenium Grid Node Selenium RC Server host_a Client Client Selenium Grid Node Selenium RC Server Client Client host_b
  • 6. Environments • Map descriptive names to browser strings • Configured in Selenium Grid Hub hub: environments: - name: "linux_firefox_3_6" browser: "*firefox /opt/firefox-3.6/firefox-bin" - name: "windows_firefox_3_5" browser: "*firefox" - name: "windows_firefox_3_6" browser: "*firefox"
  • 7. Starting the Hub • Edit grid_configuration.yml Rake: $ rake hub:start $ BACKGROUND=true nohup rake hub:start &>/dev/null ant: $ ant launch-hub $ nohup ant launch-hub >> log_file 2>&1
  • 8. Selenium Grid Console • Open http://localhost:4444/console
  • 9. Starting Up a Node Rake: $ rake rc:start $ DISPLAY=:99.0 BACKGROUND=true HOST=host_b PORT=5000 ENVIRONMENT=linux_firefox_3_6 HUB_URL='http://hub_host:4444' SELENIUM_ARGS='-ensureCleanSession -noBrowserSessionReuse' nohup rake rc:start &>/dev/null ant: $ ant launch-remote-control $ DISPLAY=:99.0 nohup ant -Dhost=host_b -Dport=5000 -Denvironment=linux_firefox_3_6 -DhubURL='http://hub_host:4444' -DseleniumArgs='-ensureCleanSession -noBrowserSessionReuse' launch-remote-control >> log_file 2>&1
  • 10. Node Registration 1. Node connects to hub Selenium Grid Node Selenium Grid Hub environment windows_firefox_3_6 host host_b port 5000
  • 11. Node Registration 1. Node connects to hub Selenium Grid Node Selenium Grid Hub environment windows_firefox_3_6 host host_b port 5000 2. Hub adds node to environment queue windows_chrome windows_firefox_3_6 host_c:5000 host_a:5000 linux_firefox_3_6 host_a:5001 host_d:5000 host_b:5000
  • 12. Available Node in Console
  • 13. Client Connection • Client connects with environment name as browser string • Hub looks up by environment & reserves a node • Blocks until one is available • Client communicates with hub at all times • Hub forwards traffic to correct node
  • 14. Client Connection Code Old: New: require 'rubygems' require 'rubygems' require 'selenium/client' require 'selenium/client' browser = browser = Selenium::Client::Driver.new Selenium::Client::Driver.new :host => 'localhost', :host => 'localhost', :port => 4444, :port => 4444, :browser => '*firefox', :browser => 'linux_firefox_3_6', :url => 'http://mogotest.com/' :url => 'http://mogotest.com/' browser.start_new_browser_session browser.start_new_browser_session browser.open 'http://mogotest.com/' browser.open 'http://mogotest.com/' browser.close_current_browser_session browser.close_current_browser_session
  • 15. Makes Testing Simpler • Client always connects to known endpoint • Hub takes care of browser allocation • Nodes can be added dynamically • Hub handles bad nodes
  • 16. Grid Resiliency • Hub can send heartbeat requests to node to tell if it has gone down • Hub can gracefully kill idle sessions • Hub can kill sessions that take too long to create
  • 17. Parallel Testing • Need a way to execute in parallel • Java: TestNG or parallel-jUnit • Ruby: DeepTest • Python: nose • Need a way to parameterize your tests for each node’s environment • Your tests must maintain their own state
  • 18. Shortcomings • Selenium 1 API compatible only • Using an old version of Selenium RC at that • 1 request per RC • Doesn’t scale vertically very well • Historically has had multi-threaded problems • Fixed as of 1.0.8
  • 19. Selenium Grid’s Future • Combine Selenium Grid & RC • De facto single-node grid • Grid available out of the box • Auto-discovery of other nodes on network
  • 20. Selenium Grid 2.0 • Proposal on dev list for new grid 2.0 • Project rewrite by François Reynaud • Supports Selenium 1 & 2 APIs • Nicer Web interface • Very extensible with callback points & listeners
  • 21. Selenium Grid 2.0 Listeners • Possible uses • Priority queue for test execution • Stat tracking • OS environment preparation
  • 22. Conclusion • Selenium Grid is alive and well • 4 releases in the last 9 months • Pushing towards a Selenium 2 compatible grid • If you have time, please review the proposed new grid code
  • 24. Resources • Project: • Source: http://github.com/nirvdrum/selenium-grid • Issues: http://selenium.googlecode.com/ • Blog: http://seleniumhq.wordpress.com/ • Personal: • Twitter: @nirvdrum • Email: [email protected]

Editor's Notes

  • #2: \n
  • #3: \n
  • #4: \n
  • #5: \n
  • #6: \n
  • #7: \n
  • #8: \n
  • #9: \n
  • #10: \n
  • #11: \n
  • #12: \n
  • #13: \n
  • #14: \n
  • #15: When running headless on *nix you’ll want to set the display value. Xvfb is a great way to do this.\n\nWhen running headless on Windows you’ll want to set up VNC so the window session remains active (RDP won’t work).\n\nThe HOST value must be a routable host from the hub’s point of view. Unless you’re running the hub and the node on the same machine, this value should not be “localhost.”\n\nThe hub URL must not end in a “/”, otherwise the node will fail to register. Yes, this is not a proper URL.\n
  • #16: \n
  • #17: \n
  • #18: \n
  • #19: \n
  • #20: \n
  • #21: \n
  • #22: \n
  • #23: \n
  • #24: \n
  • #25: Since Selenium RC Server works over HTTP, you could maintain your own list of known servers and parameterize your tests accordingly, but grid affords additional benefits.\n
  • #26: \n
  • #27: Some people are doing this with Hudson.\n\nI’m running tests using resque as an asynchronous job queuing system.\n
  • #28: \n
  • #29: \n
  • #30: \n
  • #31: \n
  • #32: \n
  • #33: \n