meet the selenium grid
TRANSCRIPT
MEET THE SELENIUM GRID
AS WEB DEVELOPER || QA WE WANT
Speedometer by Jamie Dickinson flow by Adam Terpenin Responsive Design by Korawan.M
FAST PARALLEL MULTIPLE BROWSERS / OS
– Alexey Nikolaenko
“Life is too short to run tests in a single thread”
servers by Jaime Carrion
Selenium Nodes
Selenium Hub
SELENIUM HUB
• Entry point for tests
• Routes your commands to proper Selenium Node
• Manages sessions
Selenium Hub
SELENIUM NODE
• Place where tests are executed
• Holds browser binaries
• Registers itself in Selenium Hub
Nerd Penguin by Hayden Kerrisk
HOW IT WORKS
• RemoteWebDriver abstraction
• JsonWireProtocol to communicate
HOW IT WORKS
Nodes register on grid
HOW IT WORKS
User by Wilson Joseph from the Noun Project
HOW IT WORKS
Capabilities {platform: “Windows”
browserName: “iexplore”}
/session
HOW IT WORKS
Session {sessionId: ‘xyz’,capabilities: {}
}
HOW IT WORKS
/session/:sessionId/{command}
HOW IT WORKS
Result {…}
HOW IT WORKS
DELETE /session/:sessionId
OTHER OPTIONS?
SAUCE LABS• Automated & Manual testing in browsers
• Supports over 500 browser / platform combinations
• On demand grid
• Reporting (video, screenshots, logs)
• No maintenance costs
• SSL Tunnel for ‘security’ (Sauce Connect)
SAUCE LABS
“***k PaaS, I want my in-house grid”
WHY IN-HOUSE?
• We are Big Enterprise
• Run tests for unlimited time
• N x 1000 concurrent users
• Without SSL tunnels
PROBLEMS WITH IN-HOUSE GRID• HUB doesn’t scale well. Single point of failure.
HOW TO SCALE HUB?
HOW TO SCALE HUB?
… …
HOW TO SCALE HUB?
… …
HOW TO SCALE HUB?
Grid router
… …
HOW TO SCALE HUB?
Grid router
… …
…
Load Balancer
SELENIUM GRID ROUTER
• Routes and proxies Selenium WedDriver requests to multiple Selenium Hubs
• Access control & Quotas
• Developed and used by Yandex
• https://github.com/seleniumkit/gridrouter
PROBLEMS WITH IN-HOUSE GRID• HUB doesn’t scale well. Single point of failure.
• Browser windows may loose focus in case of multiple executions
AVOID LOOSING FOCUS
• Multiple desktops. Each browser instance has own virtual desktop
• Linux - xvfb
• Windows - desktop-utils.exe (https://github.com/kybu/headless-selenium-for-win)
PROBLEMS WITH IN-HOUSE GRID• HUB doesn’t scale well. Single point of failure.
• Browser windows may loose focus in case of multiple executions
• Browser versions management
SELENIUM GRID EXTRAS
• Automatically upgrades WebDriver binaries
• Video recording, screenshots
• Centralised configuration
• https://github.com/groupon/Selenium-Grid-Extras
PROBLEMS WITH IN-HOUSE GRID• HUB doesn’t scale well. Single point of failure.
• Browser windows may loose focus in case of multiple executions
• Browser version management
• Complex UI component tests
COMPLEX UI COMPONENTS?
• Canvas (noVNC, Charts)
• Rich JS components
COMPLEX UI COMPONENTS?
• Canvas (noVNC, Charts)
• Rich JS components
SELENIUM GRID EXTENSIONSby sterodium.io
SELENIUM GRID EXTENSIONS
DOWNLOAD / UPLOAD resource capabilities
SELENIUM GRID EXTENSIONS
Extension Proxy
Node Extensions- Sikuli Extension- Files Extension
SELENIUM GRID EXTENSIONS• Sikuli requires own virtual desktop.
• Allocate virtual desktop to each Selenium node
• Limit session count to 1 per node
• Launch multiple nodes on different ports
• Images uploaded to Selenium Node.
• Same Sikuli API. Just proxied.
• http://sterodium.io/
• https://github.com/sterodium/selenium-grid-extensions
• Examples: https://github.com/echoAlexey/selenium-examples
Q/A
ABOUT ME
• Software Engineer @ Neueda Technologies
• Working on a set of tools for Test Automation.
• @echoAlexey