SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Introduction to Selenium Grid
Presented by : Ankur Thakur
QA Consultant
Lack of etiquette and manners is a huge turn off.
KnolX Etiquettes
Punctuality
Respect Knolx session timings,
you are requested not to join
sessions after a 5 minutes
threshold post the session start
time.
Feedback
Make sure to submit a
constructive feedback for all
sessions as it is very helpful for
the presenter.
Mute
Please keep your window on
mute.
Avoid Disturbance
Avoid leaving your window
unmuted after asking a question
Our Agenda
01 Small introduction : Selenium Grid
03 Selenium Grid Architecture
04
What is Selenium Grid and Why to use it?
05
Benefits of Selenium Grid
Selenium Grid vs. Saucelabs
02
Setting up the Hub and nodes
06 Jenkins CI/CD integration using Selenium grid
07
08 Demo
What is Selenium Grid and Why to use it?
● Selenium Grid is a part of the Selenium Suite that specializes in running
multiple tests across different browsers, operating systems, and
machines.
● Selenium Grid works on master slave architecture where the master or
hub runs the test scripts on slave or node machines.
● Selenium Grid can help us reduce our test execution time. This is
achieved by executing the scripts on remote machines.
● Selenium Grid helps us run our tests or multiple OS with different
browser configurations.
What is Selenium Grid and Why to use it?
● We can use Selenium Grid to run our tests with multiple data sets. Each
browser instance can execute the tests with different data.
● Cross browser testing is one of the advantages of Selenium Grid. We can
execute the same test scripts on different browsers.
Selenium Grid Architecture
What are Hub and nodes?
● Hub
○ A Hub is a central point where all your tests are sent.
○ Selenium grid contains only one hub.
● Nodes
○ Nodes are different Selenium instances that receives commands
from the hub and executes the tests on individual computer systems.
○ The machines which are nodes are not required to be on the same
platform or have the same browser selection as that of the hub or
the other nodes.
Benefits of Selenium Grid
● We can use multiple programming languages like Java, C#, Python etc to
write test scripts in Selenium Grid.
● Selenium Grid supports all the major web browsers like Chrome, Firefox,
Safari, Internet Explorer, Microsoft Edge.
● Selenium Grid also supports multiple platforms or operating systems like
Linux, Windows, macOS, etc.
● All the tests can be executed in parallel to speed up the execution speed.
Setting up the Hub
● To configure your system as a hub, download the latest Selenium server
(Grid) jar file.
● To register the system as the Hub use the following command:
○ java -jar selenium-server-standalone-3.141.59.jar -role hub
● Extract the link to register the nodes from the terminal.
Setting up the Nodes
● To configure your system as a node, we again need to download the
latest Selenium server jar file and the version should be the same as the
Hub.
● To register the system as a Node use the following command:
○ java -Dwebdriver.chrome.driver="Usersank11Downloadschromedriver" -jar
selenium-server-standalone-3.141.59.jar -role webdriver -hub
http://192.168.0.105:4444/grid/register -port 5566
● We are using the link extracted from the Hub.
The Node
How to speed up parallel execution?
The answer is to increase browser instances.
● We can set the number of browser instances that will run in parallel.
● To achieve this we can use the following command.
○ java -Dwebdriver.chrome.driver="/home/ankur/Downloads/chromedriver" -jar
selenium-server-standalone-3.141.59.jar -role webdriver -hub
http://172.16.144.1:4444/grid/register/ -browser
browserName=chrome,maxInstances=2 -maxSession 2
● Using this command we can run only 2 instances at one time.
● We can increase or decrease the instances according to our requirements.
Configuring code for chrome browser
ChromeOptions chromeOptions = new ChromeOptions();
//initialize chromeOptions
chromeOptions.setCapability("browserName", "chrome");
//Define on which browser you want to execute your tests.
chromeOptions.setCapability("platformName","LINUX");
//Define the platform on which you will execute your tests
Configuring code for firefox browser
FirefoxOptions ffOptions = new FirefoxOptions();
//initialize ffOptions
ffOptions.setCapability("browserName", "firefox");
//Define on which browser you want to execute your tests.
ffOptions.setCapability("platformName","LINUX");
//Define the platform on which you will execute your tests
Jenkins CI/CD integration using
Selenium grid
● We can also configure Selenium Grid on Jenkins using the selenium
plugin.
● After installing this plugin the jenkins acts as the hub and other nodes can
connect to it.
● We need to add node configurations, define the location of drivers
(chromedriver,gecko driver) and also define the number of maximum
instances. Then finally start the node.
● After this we can execute our tests using the headless mode in Jenkins.
Selenium Grid Hub on Jenkins
Selenium Grid node configuration on Jenkins
Selenium Grid vs. Saucelabs
● Selenium Grid is free to use and can be scaled up with adding physical
machines to our network. But Saucelabs is a paid service which only
offers a limited time trial period.
● Selenium Grid is also useful if the organization has some security
concerns regarding the data access as the tests are run on a physical
machine instead of on some device farm which is used by Saucelabs.
● Selenium Grid is open source but Saucelabs is not.
Demo
Q&A
Thank You

Contenu connexe

Tendances

What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
Simplilearn
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Simplilearn
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Simplilearn
 

Tendances (20)

Introduction to Selenium Web Driver
Introduction to Selenium Web DriverIntroduction to Selenium Web Driver
Introduction to Selenium Web Driver
 
Test Automation and Selenium
Test Automation and SeleniumTest Automation and Selenium
Test Automation and Selenium
 
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
What Is Selenium? | Selenium Basics For Beginners | Introduction To Selenium ...
 
Selenium- A Software Testing Tool
Selenium- A Software Testing ToolSelenium- A Software Testing Tool
Selenium- A Software Testing Tool
 
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
Selenium WebDriver Tutorial | Selenium WebDriver Tutorial For Beginner | Sele...
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Introduction to selenium
Introduction to seleniumIntroduction to selenium
Introduction to selenium
 
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
Selenium Tutorial For Beginners | Selenium Automation Testing Tutorial | Sele...
 
Selenium-4-and-appium-2
Selenium-4-and-appium-2Selenium-4-and-appium-2
Selenium-4-and-appium-2
 
Automation Testing using Selenium
Automation Testing using SeleniumAutomation Testing using Selenium
Automation Testing using Selenium
 
Selenium-4
Selenium-4Selenium-4
Selenium-4
 
Selenium introduction
Selenium introductionSelenium introduction
Selenium introduction
 
Automation Testing by Selenium Web Driver
Automation Testing by Selenium Web DriverAutomation Testing by Selenium Web Driver
Automation Testing by Selenium Web Driver
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Web Test Automation with Selenium
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
BDD with Cucumber
BDD with CucumberBDD with Cucumber
BDD with Cucumber
 
Selenium
SeleniumSelenium
Selenium
 
Automated testing using Selenium & NUnit
Automated testing using Selenium & NUnitAutomated testing using Selenium & NUnit
Automated testing using Selenium & NUnit
 

Similaire à Introduction to Selenium grid

Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
Nick Belhomme
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
Kumari Warsha Goel
 
Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
onlinemindq
 

Similaire à Introduction to Selenium grid (20)

Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
Docker–Grid (A On demand and Scalable dockerized selenium grid architecture)
 
Selenium Introduction and IDE
Selenium Introduction and IDESelenium Introduction and IDE
Selenium Introduction and IDE
 
How to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud SolutionsHow to work with Selenium Grid and Cloud Solutions
How to work with Selenium Grid and Cloud Solutions
 
Selenium 101 Webinar
Selenium 101 WebinarSelenium 101 Webinar
Selenium 101 Webinar
 
Scalable and Reliable Cross Browser Testing With Cypress Framework
Scalable and Reliable Cross Browser Testing With Cypress FrameworkScalable and Reliable Cross Browser Testing With Cypress Framework
Scalable and Reliable Cross Browser Testing With Cypress Framework
 
Easy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium DockerEasy Setup for Parallel Test Execution with Selenium Docker
Easy Setup for Parallel Test Execution with Selenium Docker
 
Selenium
SeleniumSelenium
Selenium
 
Be flexible with zalenium, a dockerized selenium grid infrastructure
Be flexible with zalenium, a dockerized selenium grid infrastructureBe flexible with zalenium, a dockerized selenium grid infrastructure
Be flexible with zalenium, a dockerized selenium grid infrastructure
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Selenium - Introduction
Selenium - IntroductionSelenium - Introduction
Selenium - Introduction
 
Selenium institute in bangalore
Selenium institute in bangaloreSelenium institute in bangalore
Selenium institute in bangalore
 
Cypress for Testing
Cypress for TestingCypress for Testing
Cypress for Testing
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
Selenium Introduction
Selenium IntroductionSelenium Introduction
Selenium Introduction
 
The Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote WorldThe Future of Security and Productivity in Our Newly Remote World
The Future of Security and Productivity in Our Newly Remote World
 
Selenium (1)
Selenium (1)Selenium (1)
Selenium (1)
 
How to use Selenium Grid for Multi-Browser Testing.pdf
How to use Selenium Grid for Multi-Browser Testing.pdfHow to use Selenium Grid for Multi-Browser Testing.pdf
How to use Selenium Grid for Multi-Browser Testing.pdf
 
Why Should we use Microsoft's Playwright
Why Should we use Microsoft's PlaywrightWhy Should we use Microsoft's Playwright
Why Should we use Microsoft's Playwright
 

Plus de Knoldus Inc.

Plus de Knoldus Inc. (20)

Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 
Introduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptxIntroduction to Circle Ci Presentation.pptx
Introduction to Circle Ci Presentation.pptx
 
Robusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptxRobusta -Tool Presentation (DevOps).pptx
Robusta -Tool Presentation (DevOps).pptx
 
Optimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptxOptimizing Kubernetes using GOLDILOCKS.pptx
Optimizing Kubernetes using GOLDILOCKS.pptx
 
Azure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptxAzure Function App Exception Handling.pptx
Azure Function App Exception Handling.pptx
 
CQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptxCQRS Design Pattern Presentation (Java).pptx
CQRS Design Pattern Presentation (Java).pptx
 
ETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake PresentationETL Observability: Azure to Snowflake Presentation
ETL Observability: Azure to Snowflake Presentation
 
Scripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics PresentationScripting with K6 - Beyond the Basics Presentation
Scripting with K6 - Beyond the Basics Presentation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Introduction To Rust part II Presentation
Introduction To Rust part II PresentationIntroduction To Rust part II Presentation
Introduction To Rust part II Presentation
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
Configuring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRAConfiguring Workflows & Validators in JIRA
Configuring Workflows & Validators in JIRA
 

Dernier

Dernier (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 

Introduction to Selenium grid

  • 1. Introduction to Selenium Grid Presented by : Ankur Thakur QA Consultant
  • 2. Lack of etiquette and manners is a huge turn off. KnolX Etiquettes Punctuality Respect Knolx session timings, you are requested not to join sessions after a 5 minutes threshold post the session start time. Feedback Make sure to submit a constructive feedback for all sessions as it is very helpful for the presenter. Mute Please keep your window on mute. Avoid Disturbance Avoid leaving your window unmuted after asking a question
  • 3. Our Agenda 01 Small introduction : Selenium Grid 03 Selenium Grid Architecture 04 What is Selenium Grid and Why to use it? 05 Benefits of Selenium Grid Selenium Grid vs. Saucelabs 02 Setting up the Hub and nodes 06 Jenkins CI/CD integration using Selenium grid 07 08 Demo
  • 4. What is Selenium Grid and Why to use it? ● Selenium Grid is a part of the Selenium Suite that specializes in running multiple tests across different browsers, operating systems, and machines. ● Selenium Grid works on master slave architecture where the master or hub runs the test scripts on slave or node machines. ● Selenium Grid can help us reduce our test execution time. This is achieved by executing the scripts on remote machines. ● Selenium Grid helps us run our tests or multiple OS with different browser configurations.
  • 5. What is Selenium Grid and Why to use it? ● We can use Selenium Grid to run our tests with multiple data sets. Each browser instance can execute the tests with different data. ● Cross browser testing is one of the advantages of Selenium Grid. We can execute the same test scripts on different browsers.
  • 7. What are Hub and nodes? ● Hub ○ A Hub is a central point where all your tests are sent. ○ Selenium grid contains only one hub. ● Nodes ○ Nodes are different Selenium instances that receives commands from the hub and executes the tests on individual computer systems. ○ The machines which are nodes are not required to be on the same platform or have the same browser selection as that of the hub or the other nodes.
  • 8. Benefits of Selenium Grid ● We can use multiple programming languages like Java, C#, Python etc to write test scripts in Selenium Grid. ● Selenium Grid supports all the major web browsers like Chrome, Firefox, Safari, Internet Explorer, Microsoft Edge. ● Selenium Grid also supports multiple platforms or operating systems like Linux, Windows, macOS, etc. ● All the tests can be executed in parallel to speed up the execution speed.
  • 9. Setting up the Hub ● To configure your system as a hub, download the latest Selenium server (Grid) jar file. ● To register the system as the Hub use the following command: ○ java -jar selenium-server-standalone-3.141.59.jar -role hub ● Extract the link to register the nodes from the terminal.
  • 10. Setting up the Nodes ● To configure your system as a node, we again need to download the latest Selenium server jar file and the version should be the same as the Hub. ● To register the system as a Node use the following command: ○ java -Dwebdriver.chrome.driver="Usersank11Downloadschromedriver" -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://192.168.0.105:4444/grid/register -port 5566 ● We are using the link extracted from the Hub.
  • 12. How to speed up parallel execution? The answer is to increase browser instances. ● We can set the number of browser instances that will run in parallel. ● To achieve this we can use the following command. ○ java -Dwebdriver.chrome.driver="/home/ankur/Downloads/chromedriver" -jar selenium-server-standalone-3.141.59.jar -role webdriver -hub http://172.16.144.1:4444/grid/register/ -browser browserName=chrome,maxInstances=2 -maxSession 2 ● Using this command we can run only 2 instances at one time. ● We can increase or decrease the instances according to our requirements.
  • 13. Configuring code for chrome browser ChromeOptions chromeOptions = new ChromeOptions(); //initialize chromeOptions chromeOptions.setCapability("browserName", "chrome"); //Define on which browser you want to execute your tests. chromeOptions.setCapability("platformName","LINUX"); //Define the platform on which you will execute your tests
  • 14. Configuring code for firefox browser FirefoxOptions ffOptions = new FirefoxOptions(); //initialize ffOptions ffOptions.setCapability("browserName", "firefox"); //Define on which browser you want to execute your tests. ffOptions.setCapability("platformName","LINUX"); //Define the platform on which you will execute your tests
  • 15. Jenkins CI/CD integration using Selenium grid ● We can also configure Selenium Grid on Jenkins using the selenium plugin. ● After installing this plugin the jenkins acts as the hub and other nodes can connect to it. ● We need to add node configurations, define the location of drivers (chromedriver,gecko driver) and also define the number of maximum instances. Then finally start the node. ● After this we can execute our tests using the headless mode in Jenkins.
  • 16. Selenium Grid Hub on Jenkins
  • 17. Selenium Grid node configuration on Jenkins
  • 18. Selenium Grid vs. Saucelabs ● Selenium Grid is free to use and can be scaled up with adding physical machines to our network. But Saucelabs is a paid service which only offers a limited time trial period. ● Selenium Grid is also useful if the organization has some security concerns regarding the data access as the tests are run on a physical machine instead of on some device farm which is used by Saucelabs. ● Selenium Grid is open source but Saucelabs is not.
  • 19. Demo
  • 20. Q&A