SlideShare a Scribd company logo
Cross Browser Testing using Selenium GRID
One of the challenges that we face while testing the application is testing it on
different browsers and environments. We all might have observed that some
websites are not properly displayed on some browsers and we just think that the
website is broken. But, as soon as you open it on a different browser, the website
opens up just fine. Thus, this behavior explains the compatibility of a website with
different browsers.
 By CoffeeBeans
Each browser interprets the information on the website page differently, so, some
browsers may lack the features that your website is trying to show and make your
website look broken on that browser.
That being the brief story, I bet you all have figured out the topic of today’s
discussion — Cross Browser Testing. So what is cross browser testing?
Cross browser testing is a type of testing that lets you check whether the websites
are working as intended when accessed through
 Different Browser — OS combination
 Browsers like — Chrome, Firefox, Safari, Edge, etc
 Operating Systems like — Windows, Linux, MAC, etc
It’s about shipping releases that are as browser-agnostic as possible, which is key to
delivering a uniform user experience on a diverse, ever-growing range of
browsers/devices.
As a tester, it is your responsibility to make sure that not only do applications work,
but they work for all your users, no matter what browser, device, or additional
assistive tools they are using. Now comes the next question –
Why cross-browser testing?
1. To check how the website appears on different browsers
2. To check how the website works on different browsers ( quite obvious )
3. To ensure that you’re not alienating a significant part of your target audience–
simply because your website does not work on their browser OS.
The next question which comes to mind is –
How to perform cross-browser testing?
This can be done in two (obvious) ways
1. Manual Approach (Manually check the functionality on different browsers and
platforms, painful process to follow)
2. Automation Approach (Write one piece of code and run it on different
browsers and platform combinations — sounds cool and easy right?)
That being said, let’s dive into the automation approach and see how this can be
achieved with Selenium, Selenium GRID, and TestNG
Firstly, you will need to set up a Selenium grid to run the tests on different browsers
and platforms. For this, you will need a Selenium server standalone jar which can be
found in the given link — Selenium Server Standalone Jar
Once you have downloaded the jar file, you need to set up the hub and node based
on the requirement. For the demonstration purpose, I will create 1 hub and 2 nodes.
1 of the nodes will run firefox as browser-related test cases. The other node will run
chrome-related test cases.
Let’s start by creating a hub.
The command to create a node is as follows
java -jar selenium-server-standalone-3.141.59.jar -role hub
Below is the screenshot of the hub looks when it is up and running
Once you have created a hub and have obtained the hub register URL, let’s register
a node with chrome browser-related configurations. This can be done in two ways,
1. By passing the arguments in the command line
2. By creating a JSON file with the required configurations.
I will be creating both nodes by passing the arguments from the command line. The
configuration goes as follows for creating a node with chrome browser configuration
java -Dwebdriver.chrome.driver=”/Users/macbook/Downloads/chromedriver” -jar
selenium-server-standalone-3.141.59.jar -role node -
hub http://localhost:4444/grid/register
Below is the screenshot of it looks when it is registered
Once you have registered that node, let’s register another node with firefox browser
configurations. The command to do so is as follows
java -Dwebdriver.gecko.driver=”/Users/macbook/Downloads/geckodriver” -jar
selenium-server-standalone-3.141.59.jar -role node -
hub http://localhost:4444/grid/register
Below is the screenshot of it looks when it is registered
Once both the nodes are registered it can be verified by navigating to the grid
console. The same can also be verified on the hub console
Hub Console
Grid console URL is as follows — GRID Console
After you have registered both nodes, get the hub URL and append wd/hub at the
end. We will use this URL to route the test cases to specific nodes as configured.
Hub Url — Hub URL
Now let’s create a maven project and testng.xml file so that we can run the tests
parallelly.
Let’s add the selenium and testng dependency
The next step is to initialize the browser’s drivers based on the requirement. chrome
driver if chrome browser is required, firefox driver if firefox browser is required.
Let’s write some basic test cases that are going to print the browser title from both
the browsers
Now let’s run the test cases parallelly and see if the configurations are working
Command to run the test — mvn clean test
Viola, one single test can now be run on 2 different browsers parallelly. Refer to the
console for execution results
For now, the platform in which I am running the test cases is MAC, this can be
changed when a different platform is configured like Windows, Linux, etc. TestNG file
to run the test cases parallelly is as below.
In the same way, safari and edge can also be configured to run the test cases. It
depends on the requirement of how many browsers and platforms need to be
covered.
To know more visit our remaining pages:-
Website:- https://coffeebeans.io/
Blogs:- https://coffeebeans.io/blogs

More Related Content

Similar to Cross Browser Testing using Selenium GRID

BBS Selenium & Docker
BBS Selenium & Docker BBS Selenium & Docker
BBS Selenium & Docker
Mustafa Topçuoğulları
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
Pankaj Biswas
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
RTechRInfoIT
 
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdfanoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
SunilNagaraj10
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
Anuraj S.L
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
Haitham Refaat
 
Web topic 26 browser compatibilty and security
Web topic 26  browser compatibilty and securityWeb topic 26  browser compatibilty and security
Web topic 26 browser compatibilty and security
CK Yang
 
How to do better Quality Assurance for Cross-Browser Testing
How to do better Quality Assurance for Cross-Browser TestingHow to do better Quality Assurance for Cross-Browser Testing
How to do better Quality Assurance for Cross-Browser Testing
BOSS Webtech
 
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
Knoldus Inc.
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
Fwdays
 
Selenium
SeleniumSelenium
Sel
SelSel
Qa process
Qa processQa process
Qa process
Aila Bogasieru
 
Qa process
Qa processQa process
Qa process
Aila Bogasieru
 
Web application penetration testing lab setup guide
Web application penetration testing lab setup guideWeb application penetration testing lab setup guide
Web application penetration testing lab setup guide
Sudhanshu Chauhan
 
Python selenium
Python seleniumPython selenium
Python selenium
Ducat
 
VorlonJS
VorlonJSVorlonJS
VorlonJS
Fabrício Catae
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
Mbakaya Kwatukha
 
Selenium
SeleniumSelenium
Selenium
Anjali Rao
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
Qspiders - Software Testing Training Institute
 

Similar to Cross Browser Testing using Selenium GRID (20)

BBS Selenium & Docker
BBS Selenium & Docker BBS Selenium & Docker
BBS Selenium & Docker
 
Automation Testing using Selenium Webdriver
Automation Testing using Selenium WebdriverAutomation Testing using Selenium Webdriver
Automation Testing using Selenium Webdriver
 
Selenium for Tester.pdf
Selenium for Tester.pdfSelenium for Tester.pdf
Selenium for Tester.pdf
 
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdfanoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
anoverviewofseleniumwebdriver-160407055026 (pdf.io).pdf
 
An overview of selenium webdriver
An overview of selenium webdriverAn overview of selenium webdriver
An overview of selenium webdriver
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
 
Web topic 26 browser compatibilty and security
Web topic 26  browser compatibilty and securityWeb topic 26  browser compatibilty and security
Web topic 26 browser compatibilty and security
 
How to do better Quality Assurance for Cross-Browser Testing
How to do better Quality Assurance for Cross-Browser TestingHow to do better Quality Assurance for Cross-Browser Testing
How to do better Quality Assurance for Cross-Browser Testing
 
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
 
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R..."Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
"Hidden difficulties of debugger implementation for .NET WASM apps", Andrii R...
 
Selenium
SeleniumSelenium
Selenium
 
Sel
SelSel
Sel
 
Qa process
Qa processQa process
Qa process
 
Qa process
Qa processQa process
Qa process
 
Web application penetration testing lab setup guide
Web application penetration testing lab setup guideWeb application penetration testing lab setup guide
Web application penetration testing lab setup guide
 
Python selenium
Python seleniumPython selenium
Python selenium
 
VorlonJS
VorlonJSVorlonJS
VorlonJS
 
Django simplified : by weever mbakaya
Django simplified : by weever mbakayaDjango simplified : by weever mbakaya
Django simplified : by weever mbakaya
 
Selenium
SeleniumSelenium
Selenium
 
QSpiders - Automation using Selenium
QSpiders - Automation using SeleniumQSpiders - Automation using Selenium
QSpiders - Automation using Selenium
 

Recently uploaded

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 

Recently uploaded (20)

Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 

Cross Browser Testing using Selenium GRID

  • 1. Cross Browser Testing using Selenium GRID One of the challenges that we face while testing the application is testing it on different browsers and environments. We all might have observed that some websites are not properly displayed on some browsers and we just think that the website is broken. But, as soon as you open it on a different browser, the website opens up just fine. Thus, this behavior explains the compatibility of a website with different browsers.  By CoffeeBeans Each browser interprets the information on the website page differently, so, some browsers may lack the features that your website is trying to show and make your website look broken on that browser. That being the brief story, I bet you all have figured out the topic of today’s discussion — Cross Browser Testing. So what is cross browser testing? Cross browser testing is a type of testing that lets you check whether the websites are working as intended when accessed through  Different Browser — OS combination  Browsers like — Chrome, Firefox, Safari, Edge, etc  Operating Systems like — Windows, Linux, MAC, etc
  • 2. It’s about shipping releases that are as browser-agnostic as possible, which is key to delivering a uniform user experience on a diverse, ever-growing range of browsers/devices. As a tester, it is your responsibility to make sure that not only do applications work, but they work for all your users, no matter what browser, device, or additional assistive tools they are using. Now comes the next question – Why cross-browser testing? 1. To check how the website appears on different browsers 2. To check how the website works on different browsers ( quite obvious ) 3. To ensure that you’re not alienating a significant part of your target audience– simply because your website does not work on their browser OS. The next question which comes to mind is – How to perform cross-browser testing? This can be done in two (obvious) ways 1. Manual Approach (Manually check the functionality on different browsers and platforms, painful process to follow) 2. Automation Approach (Write one piece of code and run it on different browsers and platform combinations — sounds cool and easy right?) That being said, let’s dive into the automation approach and see how this can be achieved with Selenium, Selenium GRID, and TestNG Firstly, you will need to set up a Selenium grid to run the tests on different browsers and platforms. For this, you will need a Selenium server standalone jar which can be found in the given link — Selenium Server Standalone Jar Once you have downloaded the jar file, you need to set up the hub and node based on the requirement. For the demonstration purpose, I will create 1 hub and 2 nodes.
  • 3. 1 of the nodes will run firefox as browser-related test cases. The other node will run chrome-related test cases. Let’s start by creating a hub. The command to create a node is as follows java -jar selenium-server-standalone-3.141.59.jar -role hub Below is the screenshot of the hub looks when it is up and running Once you have created a hub and have obtained the hub register URL, let’s register a node with chrome browser-related configurations. This can be done in two ways, 1. By passing the arguments in the command line 2. By creating a JSON file with the required configurations. I will be creating both nodes by passing the arguments from the command line. The configuration goes as follows for creating a node with chrome browser configuration
  • 4. java -Dwebdriver.chrome.driver=”/Users/macbook/Downloads/chromedriver” -jar selenium-server-standalone-3.141.59.jar -role node - hub http://localhost:4444/grid/register Below is the screenshot of it looks when it is registered Once you have registered that node, let’s register another node with firefox browser configurations. The command to do so is as follows java -Dwebdriver.gecko.driver=”/Users/macbook/Downloads/geckodriver” -jar selenium-server-standalone-3.141.59.jar -role node - hub http://localhost:4444/grid/register Below is the screenshot of it looks when it is registered
  • 5. Once both the nodes are registered it can be verified by navigating to the grid console. The same can also be verified on the hub console Hub Console
  • 6. Grid console URL is as follows — GRID Console After you have registered both nodes, get the hub URL and append wd/hub at the end. We will use this URL to route the test cases to specific nodes as configured. Hub Url — Hub URL Now let’s create a maven project and testng.xml file so that we can run the tests parallelly. Let’s add the selenium and testng dependency
  • 7. The next step is to initialize the browser’s drivers based on the requirement. chrome driver if chrome browser is required, firefox driver if firefox browser is required.
  • 8. Let’s write some basic test cases that are going to print the browser title from both the browsers Now let’s run the test cases parallelly and see if the configurations are working
  • 9. Command to run the test — mvn clean test Viola, one single test can now be run on 2 different browsers parallelly. Refer to the console for execution results For now, the platform in which I am running the test cases is MAC, this can be changed when a different platform is configured like Windows, Linux, etc. TestNG file to run the test cases parallelly is as below.
  • 10. In the same way, safari and edge can also be configured to run the test cases. It depends on the requirement of how many browsers and platforms need to be covered. To know more visit our remaining pages:- Website:- https://coffeebeans.io/ Blogs:- https://coffeebeans.io/blogs