SlideShare a Scribd company logo
1 of 48
SELENIUM 4.0 GRID OBSERVABILITY
LAB
#ATAGTR2021 DAY 2 12TH DECEMBER 2021
Aditya Garg
MY SOCIAL MEDIA HANDLES
https://twitter.com/adigindia
https://www.linkedin.com/in/adigarg/
WHAT WILL BE
COVERED
1. Selenium Grid and importance of traceability in Distributed architecture
2. Understanding Observability components in Selenium 4.0 and installing
coursier
3. Setting up a GCP machine with docker
4. Opening up necessary ports
5. Running Jaeger on the GCP machine
6. Setting up traceability in SeleniumGrid 4.0
7. Executing the tests and observing the trace
Have you worked on Java and Selenium before (yes or no)
ⓘ Start presenting to display the poll results on this slide.
Have you worked in Selenium Grid before
ⓘ Start presenting to display the poll results on this slide.
MORE QUESTIONS
1. How many of you would be participating in this Lab with me ?
2. Do you have your laptops ready ?
3. Do you have the following installed
1. JDK 1.8
2. Maven
4. Do you have PowerShell installed ?
5. Do you have your account with GCP ?
CHECKS CONTINUED
1. Double check on few things
Follow along with me
1. Java check
2. Maven check
3. Selenium 4.0 latest Jar
4. Powershell check
5. GCP account
https://docs.microsoft.com/en-
us/powershell/scripting/install/installing-powershell-on-
windows?view=powershell-7.2#msi
https://www.selenium.dev/downloads/
https://ataevents.online/LabGuideATAGTR2021
SELENIUM GRID AND IMPORTANCE OF
TRACEABILITY/OBSERVABILITY IN
DISTRIBUTED ARCHITECTURE
Grid
3.X
1. Multiple nodes
Ref: https://www.lambdatest.com/blog/selenium-grid-4-tutorial-for-distributed-testing/
Grid
4.0
Ref: https://www.browserstack.com/guide/selenium-grid-4-tutorial
What
can
go
wrong
Any of the process Any of the nodes
• Imagine running your tests
on a fully distributed
architecture and things are
not going as planned.
• How do you trace or observe
your request going through
multiple processes and
running on a node (specially
if things are not working as
planned)
This is where observability comes in
We can trace every request in a time series manner
OpenTelemetry
Grid 4.0 is special in more than
many ways
1. It is designed to work with
modern infrastructures like
docker and Kubernetes
2. The code is by default
instrumented with
OpenTelemetry
OpenTelemetry 1. Telemetry Data such as
traces, metrics and logs
2. Popular Opensource
Backends (which help
us analyze or use this
data)
a. Jaeger
b. Prometheus
Grid
4.0
is
fully
observable Grid 4.0 is special in more than
many ways
1. It is designed to work with
modern infrastructures like
docker and Kubernetes
2. The code is by default
instrumented with
OpenTelemetry
This is where the entire request responses telemetry data ((metrics, logs, and traces) can be
instrumented, collected, and exported to help us analyze our Grid’s performance and behavior.
Selenium 4 Grid is thus fully observable – it helps us troubleshoot issues, optimize performance, and
provide visibility into the system
Selenium
Grid
4
Observability
components
1
Open Telemetry which is instrumented in the
Selenium 4.0 Jar files or code itself.
• This helps in tracing every requests lifecycle
• Trace contains details about the information called as spans
• Span records time logs – called as events
• All these are nothing but some form of logs – which we were
already used to see on a command prompt.
• This can be configured easily to send all the data to a backend
data consolidator – Jaeger
Selenium
Grid
4
Observability
components
• Since Console logs becomes too tedious to query and analyze
• We need a mechanism for visualizing and querying traces
• Jaeger seamlessly integrates with OpenTelemetry to provide a
rich experience of querying, visualizing and collecting request
traces
https://www.jaegertracing.io/
2
The second player in the Selenium 4.0
Observability is Jaeger
LET US GET INTO SOME ACTION
1
2
3
Using Selenium 4.0 Jar
Installing coursier – which is used for updating the classpath for tracer (open telemetery)
Running Jaeger
We can install using binaries or run docker through docker images
Selenium
Grid
4
Observability
Setup
java -jar selenium-server-4.1.0.jar info tracing
This example uses a tool called "coursier" to generate a full classpath, but
you can also write this manually. When started this way, the selenium
server will inform you that it has found a tracer on stdout.
1
Selenium
Grid
4
Observability
Setup
2
Installing coursier – which is used for updating the
classpath for tracer (open telemetery)
https://get-coursier.io/docs/overview#coursier
https://get-coursier.io/docs/cli-installation
Selenium
Grid
4
Observability
Setup
Selenium
Grid
4
Observability
Setup
3
Running Jaeger
We can install using binaries or run docker through docker images
https://www.jaegertracing.io/
docker run -d --name jaeger -p 16686:16686 -p 14250:14250
jaegertracing/all-in-one:latest
Selenium
Grid
4
Observability
Setup
Do you have docker installed on your machine ?
Selenium
Grid
4
Observability
Setup
https://console.cloud.google.com
1. We will create a VM with pre-
installed docker
2. Open required ports
3. Install and run Jaeger
4. If you already have docker installed,
you do not need these steps.
Docker Engine Community on Ubuntu 18.04 LTS
Selenium
Grid
4
Observability
Setup docker run -d --name jaeger -p 16686:16686 -p 14250:14250
jaegertracing/all-in-one:latest
We will run our docker VM in a GCP
Open ports 16686 and also 14250 for our telemetry needs
Run the Jaeger image
0.0.0.0/0
Selenium
Grid
4
Observability
Setup
2 Running Jaeger
We can install using binaries or run docker through docker images
https://www.jaegertracing.io/
docker run -d --name jaeger -p 16686:16686 -p 14250:14250
jaegertracing/all-in-one:latest
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
java -D"otel.traces.exporter=jaeger" -
D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" -
D"otel.resource.attributes=service.name=selenium-event-bus" -jar
selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc-
netty:1.35.0) event-bus
a
Start Event Bus – connect to Jaeger and enable opentelemetry using –
ext option using coursier
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
java -D"otel.traces.exporter=jaeger" -
D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" -
D"otel.resource.attributes=service.name=selenium-sessions" -jar
selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc-
netty:1.35.0) sessions
b Start sessionMap – connect to Jaeger and enable opentelemetry
using –ext option using coursier
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
java -D"otel.traces.exporter=jaeger" -
D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" -
D"otel.resource.attributes=service.name=selenium-session-queue" -jar
selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc-
netty:1.35.0) sessionqueue
c Start sessionQueue – connect to Jaeger and enable
opentelemetry using –ext option using coursier
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
java -D"otel.traces.exporter=jaeger" -
D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" -
D"otel.resource.attributes=service.name=selenium-distributor" -jar
selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc-
netty:1.35.0) distributor --sessions http://localhost:5556 --sessionqueue
http://localhost:5559 --bind-bus false
d Start distributor – connect to Jaeger and enable opentelemetry
using –ext option using coursier
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
java -D"otel.traces.exporter=jaeger" -
D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" -
D"otel.resource.attributes=service.name=selenium-router" -jar selenium-
server-4.0.0-rc-2.jar --ext $(cs fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc-
netty:1.35.0) router --sessions http://localhost:5556 --sessionqueue
http://localhost:5559 --distributor http://localhost:5553
e Start router – connect to Jaeger and enable opentelemetry using –
ext option using coursier
Selenium
Grid
4
Observability
Setup
3
Running Selenium Grid with OpenTelemetery Java extension classes
connected to the running instance of Jaeger
We will be running distributed grid
java -D"otel.traces.exporter=jaeger" -
D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" -
D"otel.resource.attributes=service.name=selenium-node" -jar selenium-
server-4.0.0-rc-2.jar --ext $(cs fetch -p
io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc-
netty:1.35.0) node
f Start node – connect to Jaeger and enable opentelemetry using –
ext option using coursier
Selenium
Grid
4
Observability
Setup
Selenium
Grid
4
Observability
Setup
Selenium
Grid
4
Observability
Setup
4
Add the necessary telemetry dependencies in selenium client
and run the code
a Add telemetry related dependencies in POM file
https://gitlab.com/adigindia/atagtr2021selenium4observability
Selenium
Grid
4
Observability
Setup
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-jaeger</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.35.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>31.0.1-jre</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.netty/netty-handler -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.68.Final</version>
</dependency>
a
Add telemetry
related
dependencies in
POM file
4
Add the necessary
telemetry dependencies in
selenium client and run the
code
Selenium
Grid
4
Observability
Setup
4
Add the necessary telemetry dependencies in selenium client and run
the code
b Add system properties in selenium client code
System.setProperty("otel.traces.exporter", "jaeger");
System.setProperty("otel.exporter.jaeger.endpoint",
"http://164.52.192.223:14250");
System.setProperty("otel.resource.attributes", "service.name=selenium-java-client");
ImmutableCapabilities capabilities = new ImmutableCapabilities("browserName",
"chrome");
driver = new RemoteWebDriver(new URL(hubURL), capabilities);
String hubURL = "http://localhost:4444";
RUN THE CODE AND
OBSERVE
OBSERVE ON JAEGER
BRING NODE DOWN AND
OBSERVE ON JAEGER
Key
references
1. https://www.selenium.dev/blog/2021/selenium-4-observability/
2. https://www.selenium.dev/documentation/webdriver/remote_webdriver/
3. https://github.com/manoj9788/tracing-selenium-grid
4. https://get-coursier.io/docs/cli-installation
5. https://www.ibm.com/docs/en/sdk-java-technology/7.1?topic=jjc-specifying-java-
options-system-properties-2
6. https://github.com/SeleniumHQ/selenium/blob/selenium-4.0.0-beta-
1/java/server/src/org/openqa/selenium/grid/commands/tracing.txt
7. https://opentelemetry.io/docs/java/
8. https://www.lambdatest.com/blog/selenium-grid-4-tutorial-for-distributed-testing/
9. https://www.browserstack.com/guide/selenium-grid-4-tutorial
10.https://docs.docker.com/compose/environment-variables/
11.https://github.com/SeleniumHQ/docker-selenium
THANK YOU
https://twitter.com/adigindia
https://www.linkedin.com/in/adigarg/

More Related Content

What's hot

DevOps - Interview Question.pdf
DevOps - Interview Question.pdfDevOps - Interview Question.pdf
DevOps - Interview Question.pdf
MinhTrnNht7
 

What's hot (20)

A brief study on Kubernetes and its components
A brief study on Kubernetes and its componentsA brief study on Kubernetes and its components
A brief study on Kubernetes and its components
 
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)
 
Migrating Java JBoss EAP Applications to Kubernetes With S2I
Migrating Java JBoss EAP Applications to Kubernetes With S2IMigrating Java JBoss EAP Applications to Kubernetes With S2I
Migrating Java JBoss EAP Applications to Kubernetes With S2I
 
CKA Certified Kubernetes Administrator Notes
CKA Certified Kubernetes Administrator Notes CKA Certified Kubernetes Administrator Notes
CKA Certified Kubernetes Administrator Notes
 
Deep dive into Kubernetes Networking
Deep dive into Kubernetes NetworkingDeep dive into Kubernetes Networking
Deep dive into Kubernetes Networking
 
Ansible Automation to Rule Them All
Ansible Automation to Rule Them AllAnsible Automation to Rule Them All
Ansible Automation to Rule Them All
 
Testing microservices with rest assured
Testing microservices with rest assuredTesting microservices with rest assured
Testing microservices with rest assured
 
Everything You Need To Know About Persistent Storage in Kubernetes
Everything You Need To Know About Persistent Storage in KubernetesEverything You Need To Know About Persistent Storage in Kubernetes
Everything You Need To Know About Persistent Storage in Kubernetes
 
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
AnsibleFest 2021 - DevSecOps with Ansible, OpenShift Virtualization, Packer a...
 
Kubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platformKubernetes your tests! automation with docker on google cloud platform
Kubernetes your tests! automation with docker on google cloud platform
 
Terraform
TerraformTerraform
Terraform
 
DevOps - Interview Question.pdf
DevOps - Interview Question.pdfDevOps - Interview Question.pdf
DevOps - Interview Question.pdf
 
Introduction to Kubernetes RBAC
Introduction to Kubernetes RBACIntroduction to Kubernetes RBAC
Introduction to Kubernetes RBAC
 
Comprehensive Terraform Training
Comprehensive Terraform TrainingComprehensive Terraform Training
Comprehensive Terraform Training
 
Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an Introduction
 
Automation testing & Unit testing
Automation testing & Unit testingAutomation testing & Unit testing
Automation testing & Unit testing
 
Kubernetes training
Kubernetes trainingKubernetes training
Kubernetes training
 
Kubernetes Networking
Kubernetes NetworkingKubernetes Networking
Kubernetes Networking
 
Kubernetes Helm: Why It Matters
Kubernetes Helm: Why It MattersKubernetes Helm: Why It Matters
Kubernetes Helm: Why It Matters
 
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...How to test infrastructure code: automated testing for Terraform, Kubernetes,...
How to test infrastructure code: automated testing for Terraform, Kubernetes,...
 

Similar to #ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"

Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
telestax
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
camp_drupal_ua
 
Developing modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsDeveloping modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular js
Shekhar Gulati
 

Similar to #ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab" (20)

Session on Launching Selenium Grid and Running tests using docker compose and...
Session on Launching Selenium Grid and Running tests using docker compose and...Session on Launching Selenium Grid and Running tests using docker compose and...
Session on Launching Selenium Grid and Running tests using docker compose and...
 
Distributed Tracing
Distributed TracingDistributed Tracing
Distributed Tracing
 
New selenium rc
New selenium rcNew selenium rc
New selenium rc
 
The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9The Diabolical Developer's Guide to Surviving Java 9
The Diabolical Developer's Guide to Surviving Java 9
 
First steps with selenium rc
First steps with selenium rcFirst steps with selenium rc
First steps with selenium rc
 
Distributed tracing 101
Distributed tracing 101Distributed tracing 101
Distributed tracing 101
 
OpenShift for Java EE Developers
OpenShift for Java EE DevelopersOpenShift for Java EE Developers
OpenShift for Java EE Developers
 
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
Mobicents Summit 2012 - George Vagenas - Testing SIP Applications with Arquil...
 
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-JupiterToolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
Toolbox for Selenium Tests in Java: WebDriverManager and Selenium-Jupiter
 
Mobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructureMobile Test Automation using one API and one infrastructure
Mobile Test Automation using one API and one infrastructure
 
Developing Selenium tests with JUnit 5
Developing Selenium tests with JUnit 5Developing Selenium tests with JUnit 5
Developing Selenium tests with JUnit 5
 
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-AppsSelenium-Browser-Based-Automated-Testing-for-Grails-Apps
Selenium-Browser-Based-Automated-Testing-for-Grails-Apps
 
Selenium Training in Chennai
Selenium Training in ChennaiSelenium Training in Chennai
Selenium Training in Chennai
 
Toward dynamic analysis of obfuscated android malware
Toward dynamic analysis of obfuscated android malwareToward dynamic analysis of obfuscated android malware
Toward dynamic analysis of obfuscated android malware
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 
Selendroid in Action
Selendroid in ActionSelendroid in Action
Selendroid in Action
 
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011Automated UI testing.Selenium.DrupalCamp Kyiv 2011
Automated UI testing.Selenium.DrupalCamp Kyiv 2011
 
Automated UI testing with Selenium
Automated UI testing with SeleniumAutomated UI testing with Selenium
Automated UI testing with Selenium
 
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarTestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
 
Developing modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular jsDeveloping modern java web applications with java ee 7 and angular js
Developing modern java web applications with java ee 7 and angular js
 

More from Agile Testing Alliance

More from Agile Testing Alliance (20)

#Interactive Session by Anindita Rath and Mahathee Dandibhotla, "From Good to...
#Interactive Session by Anindita Rath and Mahathee Dandibhotla, "From Good to...#Interactive Session by Anindita Rath and Mahathee Dandibhotla, "From Good to...
#Interactive Session by Anindita Rath and Mahathee Dandibhotla, "From Good to...
 
#Interactive Session by Ajay Balamurugadas, "Where Are The Real Testers In T...
#Interactive Session by  Ajay Balamurugadas, "Where Are The Real Testers In T...#Interactive Session by  Ajay Balamurugadas, "Where Are The Real Testers In T...
#Interactive Session by Ajay Balamurugadas, "Where Are The Real Testers In T...
 
#Interactive Session by Jishnu Nambiar and Mayur Ovhal, "Monitoring Web Per...
#Interactive Session by  Jishnu Nambiar and  Mayur Ovhal, "Monitoring Web Per...#Interactive Session by  Jishnu Nambiar and  Mayur Ovhal, "Monitoring Web Per...
#Interactive Session by Jishnu Nambiar and Mayur Ovhal, "Monitoring Web Per...
 
#Interactive Session by Pradipta Biswas and Sucheta Saurabh Chitale, "Navigat...
#Interactive Session by Pradipta Biswas and Sucheta Saurabh Chitale, "Navigat...#Interactive Session by Pradipta Biswas and Sucheta Saurabh Chitale, "Navigat...
#Interactive Session by Pradipta Biswas and Sucheta Saurabh Chitale, "Navigat...
 
#Interactive Session by Apoorva Ram, "The Art of Storytelling for Testers" at...
#Interactive Session by Apoorva Ram, "The Art of Storytelling for Testers" at...#Interactive Session by Apoorva Ram, "The Art of Storytelling for Testers" at...
#Interactive Session by Apoorva Ram, "The Art of Storytelling for Testers" at...
 
#Interactive Session by Nikhil Jain, "Catch All Mail With Graph" at #ATAGTR2023.
#Interactive Session by Nikhil Jain, "Catch All Mail With Graph" at #ATAGTR2023.#Interactive Session by Nikhil Jain, "Catch All Mail With Graph" at #ATAGTR2023.
#Interactive Session by Nikhil Jain, "Catch All Mail With Graph" at #ATAGTR2023.
 
#Interactive Session by Ashok Kumar S, "Test Data the key to robust test cove...
#Interactive Session by Ashok Kumar S, "Test Data the key to robust test cove...#Interactive Session by Ashok Kumar S, "Test Data the key to robust test cove...
#Interactive Session by Ashok Kumar S, "Test Data the key to robust test cove...
 
#Interactive Session by Seema Kohli, "Test Leadership in the Era of Artificia...
#Interactive Session by Seema Kohli, "Test Leadership in the Era of Artificia...#Interactive Session by Seema Kohli, "Test Leadership in the Era of Artificia...
#Interactive Session by Seema Kohli, "Test Leadership in the Era of Artificia...
 
#Interactive Session by Ashwini Lalit, RRR of Test Automation Maintenance" at...
#Interactive Session by Ashwini Lalit, RRR of Test Automation Maintenance" at...#Interactive Session by Ashwini Lalit, RRR of Test Automation Maintenance" at...
#Interactive Session by Ashwini Lalit, RRR of Test Automation Maintenance" at...
 
#Interactive Session by Srithanga Aishvarya T, "Machine Learning Model to aut...
#Interactive Session by Srithanga Aishvarya T, "Machine Learning Model to aut...#Interactive Session by Srithanga Aishvarya T, "Machine Learning Model to aut...
#Interactive Session by Srithanga Aishvarya T, "Machine Learning Model to aut...
 
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
#Interactive Session by Kirti Ranjan Satapathy and Nandini K, "Elements of Qu...
 
#Interactive Session by Sudhir Upadhyay and Ashish Kumar, "Strengthening Test...
#Interactive Session by Sudhir Upadhyay and Ashish Kumar, "Strengthening Test...#Interactive Session by Sudhir Upadhyay and Ashish Kumar, "Strengthening Test...
#Interactive Session by Sudhir Upadhyay and Ashish Kumar, "Strengthening Test...
 
#Interactive Session by Sayan Deb Kundu, "Testing Gen AI Applications" at #AT...
#Interactive Session by Sayan Deb Kundu, "Testing Gen AI Applications" at #AT...#Interactive Session by Sayan Deb Kundu, "Testing Gen AI Applications" at #AT...
#Interactive Session by Sayan Deb Kundu, "Testing Gen AI Applications" at #AT...
 
#Interactive Session by Dinesh Boravke, "Zero Defects – Myth or Reality" at #...
#Interactive Session by Dinesh Boravke, "Zero Defects – Myth or Reality" at #...#Interactive Session by Dinesh Boravke, "Zero Defects – Myth or Reality" at #...
#Interactive Session by Dinesh Boravke, "Zero Defects – Myth or Reality" at #...
 
#Interactive Session by Saby Saurabh Bhardwaj, "Redefine Quality Assurance –...
#Interactive Session by  Saby Saurabh Bhardwaj, "Redefine Quality Assurance –...#Interactive Session by  Saby Saurabh Bhardwaj, "Redefine Quality Assurance –...
#Interactive Session by Saby Saurabh Bhardwaj, "Redefine Quality Assurance –...
 
#Keynote Session by Sanjay Kumar, "Innovation Inspired Testing!!" at #ATAGTR2...
#Keynote Session by Sanjay Kumar, "Innovation Inspired Testing!!" at #ATAGTR2...#Keynote Session by Sanjay Kumar, "Innovation Inspired Testing!!" at #ATAGTR2...
#Keynote Session by Sanjay Kumar, "Innovation Inspired Testing!!" at #ATAGTR2...
 
#Keynote Session by Schalk Cronje, "Don’t Containerize me" at #ATAGTR2023.
#Keynote Session by Schalk Cronje, "Don’t Containerize me" at #ATAGTR2023.#Keynote Session by Schalk Cronje, "Don’t Containerize me" at #ATAGTR2023.
#Keynote Session by Schalk Cronje, "Don’t Containerize me" at #ATAGTR2023.
 
#Interactive Session by Chidambaram Vetrivel and Venkatesh Belde, "Revolution...
#Interactive Session by Chidambaram Vetrivel and Venkatesh Belde, "Revolution...#Interactive Session by Chidambaram Vetrivel and Venkatesh Belde, "Revolution...
#Interactive Session by Chidambaram Vetrivel and Venkatesh Belde, "Revolution...
 
#Interactive Session by Aniket Diwakar Kadukar and Padimiti Vaidik Eswar Dat...
#Interactive Session by Aniket Diwakar Kadukar and  Padimiti Vaidik Eswar Dat...#Interactive Session by Aniket Diwakar Kadukar and  Padimiti Vaidik Eswar Dat...
#Interactive Session by Aniket Diwakar Kadukar and Padimiti Vaidik Eswar Dat...
 
#Interactive Session by Vivek Patle and Jahnavi Umarji, "Empowering Functiona...
#Interactive Session by Vivek Patle and Jahnavi Umarji, "Empowering Functiona...#Interactive Session by Vivek Patle and Jahnavi Umarji, "Empowering Functiona...
#Interactive Session by Vivek Patle and Jahnavi Umarji, "Empowering Functiona...
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
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
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"

  • 1. SELENIUM 4.0 GRID OBSERVABILITY LAB #ATAGTR2021 DAY 2 12TH DECEMBER 2021 Aditya Garg
  • 2. MY SOCIAL MEDIA HANDLES https://twitter.com/adigindia https://www.linkedin.com/in/adigarg/
  • 3. WHAT WILL BE COVERED 1. Selenium Grid and importance of traceability in Distributed architecture 2. Understanding Observability components in Selenium 4.0 and installing coursier 3. Setting up a GCP machine with docker 4. Opening up necessary ports 5. Running Jaeger on the GCP machine 6. Setting up traceability in SeleniumGrid 4.0 7. Executing the tests and observing the trace
  • 4. Have you worked on Java and Selenium before (yes or no) ⓘ Start presenting to display the poll results on this slide.
  • 5. Have you worked in Selenium Grid before ⓘ Start presenting to display the poll results on this slide.
  • 6. MORE QUESTIONS 1. How many of you would be participating in this Lab with me ? 2. Do you have your laptops ready ? 3. Do you have the following installed 1. JDK 1.8 2. Maven 4. Do you have PowerShell installed ? 5. Do you have your account with GCP ?
  • 7. CHECKS CONTINUED 1. Double check on few things Follow along with me 1. Java check 2. Maven check 3. Selenium 4.0 latest Jar 4. Powershell check 5. GCP account https://docs.microsoft.com/en- us/powershell/scripting/install/installing-powershell-on- windows?view=powershell-7.2#msi https://www.selenium.dev/downloads/ https://ataevents.online/LabGuideATAGTR2021
  • 8. SELENIUM GRID AND IMPORTANCE OF TRACEABILITY/OBSERVABILITY IN DISTRIBUTED ARCHITECTURE
  • 9. Grid 3.X 1. Multiple nodes Ref: https://www.lambdatest.com/blog/selenium-grid-4-tutorial-for-distributed-testing/
  • 11. What can go wrong Any of the process Any of the nodes • Imagine running your tests on a fully distributed architecture and things are not going as planned. • How do you trace or observe your request going through multiple processes and running on a node (specially if things are not working as planned) This is where observability comes in We can trace every request in a time series manner
  • 12. OpenTelemetry Grid 4.0 is special in more than many ways 1. It is designed to work with modern infrastructures like docker and Kubernetes 2. The code is by default instrumented with OpenTelemetry
  • 13. OpenTelemetry 1. Telemetry Data such as traces, metrics and logs 2. Popular Opensource Backends (which help us analyze or use this data) a. Jaeger b. Prometheus
  • 14. Grid 4.0 is fully observable Grid 4.0 is special in more than many ways 1. It is designed to work with modern infrastructures like docker and Kubernetes 2. The code is by default instrumented with OpenTelemetry This is where the entire request responses telemetry data ((metrics, logs, and traces) can be instrumented, collected, and exported to help us analyze our Grid’s performance and behavior. Selenium 4 Grid is thus fully observable – it helps us troubleshoot issues, optimize performance, and provide visibility into the system
  • 15. Selenium Grid 4 Observability components 1 Open Telemetry which is instrumented in the Selenium 4.0 Jar files or code itself. • This helps in tracing every requests lifecycle • Trace contains details about the information called as spans • Span records time logs – called as events • All these are nothing but some form of logs – which we were already used to see on a command prompt. • This can be configured easily to send all the data to a backend data consolidator – Jaeger
  • 16. Selenium Grid 4 Observability components • Since Console logs becomes too tedious to query and analyze • We need a mechanism for visualizing and querying traces • Jaeger seamlessly integrates with OpenTelemetry to provide a rich experience of querying, visualizing and collecting request traces https://www.jaegertracing.io/ 2 The second player in the Selenium 4.0 Observability is Jaeger
  • 17. LET US GET INTO SOME ACTION 1 2 3 Using Selenium 4.0 Jar Installing coursier – which is used for updating the classpath for tracer (open telemetery) Running Jaeger We can install using binaries or run docker through docker images
  • 18. Selenium Grid 4 Observability Setup java -jar selenium-server-4.1.0.jar info tracing This example uses a tool called "coursier" to generate a full classpath, but you can also write this manually. When started this way, the selenium server will inform you that it has found a tracer on stdout. 1
  • 19. Selenium Grid 4 Observability Setup 2 Installing coursier – which is used for updating the classpath for tracer (open telemetery) https://get-coursier.io/docs/overview#coursier https://get-coursier.io/docs/cli-installation
  • 21. Selenium Grid 4 Observability Setup 3 Running Jaeger We can install using binaries or run docker through docker images https://www.jaegertracing.io/ docker run -d --name jaeger -p 16686:16686 -p 14250:14250 jaegertracing/all-in-one:latest
  • 22. Selenium Grid 4 Observability Setup Do you have docker installed on your machine ?
  • 23. Selenium Grid 4 Observability Setup https://console.cloud.google.com 1. We will create a VM with pre- installed docker 2. Open required ports 3. Install and run Jaeger 4. If you already have docker installed, you do not need these steps.
  • 24. Docker Engine Community on Ubuntu 18.04 LTS
  • 25. Selenium Grid 4 Observability Setup docker run -d --name jaeger -p 16686:16686 -p 14250:14250 jaegertracing/all-in-one:latest We will run our docker VM in a GCP Open ports 16686 and also 14250 for our telemetry needs Run the Jaeger image
  • 26.
  • 28. Selenium Grid 4 Observability Setup 2 Running Jaeger We can install using binaries or run docker through docker images https://www.jaegertracing.io/ docker run -d --name jaeger -p 16686:16686 -p 14250:14250 jaegertracing/all-in-one:latest
  • 29. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid
  • 30. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid java -D"otel.traces.exporter=jaeger" - D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" - D"otel.resource.attributes=service.name=selenium-event-bus" -jar selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc- netty:1.35.0) event-bus a Start Event Bus – connect to Jaeger and enable opentelemetry using – ext option using coursier
  • 31. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid java -D"otel.traces.exporter=jaeger" - D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" - D"otel.resource.attributes=service.name=selenium-sessions" -jar selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc- netty:1.35.0) sessions b Start sessionMap – connect to Jaeger and enable opentelemetry using –ext option using coursier
  • 32. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid java -D"otel.traces.exporter=jaeger" - D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" - D"otel.resource.attributes=service.name=selenium-session-queue" -jar selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc- netty:1.35.0) sessionqueue c Start sessionQueue – connect to Jaeger and enable opentelemetry using –ext option using coursier
  • 33. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid java -D"otel.traces.exporter=jaeger" - D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" - D"otel.resource.attributes=service.name=selenium-distributor" -jar selenium-server-4.0.0-rc-2.jar --ext $(cs fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc- netty:1.35.0) distributor --sessions http://localhost:5556 --sessionqueue http://localhost:5559 --bind-bus false d Start distributor – connect to Jaeger and enable opentelemetry using –ext option using coursier
  • 34. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid java -D"otel.traces.exporter=jaeger" - D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" - D"otel.resource.attributes=service.name=selenium-router" -jar selenium- server-4.0.0-rc-2.jar --ext $(cs fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc- netty:1.35.0) router --sessions http://localhost:5556 --sessionqueue http://localhost:5559 --distributor http://localhost:5553 e Start router – connect to Jaeger and enable opentelemetry using – ext option using coursier
  • 35. Selenium Grid 4 Observability Setup 3 Running Selenium Grid with OpenTelemetery Java extension classes connected to the running instance of Jaeger We will be running distributed grid java -D"otel.traces.exporter=jaeger" - D"otel.exporter.jaeger.endpoint=http://164.52.192.223:14250" - D"otel.resource.attributes=service.name=selenium-node" -jar selenium- server-4.0.0-rc-2.jar --ext $(cs fetch -p io.opentelemetry:opentelemetry-exporter-jaeger:1.0.0 io.grpc:grpc- netty:1.35.0) node f Start node – connect to Jaeger and enable opentelemetry using – ext option using coursier
  • 38. Selenium Grid 4 Observability Setup 4 Add the necessary telemetry dependencies in selenium client and run the code a Add telemetry related dependencies in POM file https://gitlab.com/adigindia/atagtr2021selenium4observability
  • 39. Selenium Grid 4 Observability Setup <dependency> <groupId>io.opentelemetry</groupId> <artifactId>opentelemetry-exporter-jaeger</artifactId> <version>1.0.0</version> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-netty</artifactId> <version>1.35.0</version> </dependency> <!-- https://mvnrepository.com/artifact/com.google.guava/guava --> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>31.0.1-jre</version> </dependency> <!-- https://mvnrepository.com/artifact/io.netty/netty-handler --> <dependency> <groupId>io.netty</groupId> <artifactId>netty-handler</artifactId> <version>4.1.68.Final</version> </dependency> a Add telemetry related dependencies in POM file 4 Add the necessary telemetry dependencies in selenium client and run the code
  • 40. Selenium Grid 4 Observability Setup 4 Add the necessary telemetry dependencies in selenium client and run the code b Add system properties in selenium client code System.setProperty("otel.traces.exporter", "jaeger"); System.setProperty("otel.exporter.jaeger.endpoint", "http://164.52.192.223:14250"); System.setProperty("otel.resource.attributes", "service.name=selenium-java-client"); ImmutableCapabilities capabilities = new ImmutableCapabilities("browserName", "chrome"); driver = new RemoteWebDriver(new URL(hubURL), capabilities); String hubURL = "http://localhost:4444";
  • 41. RUN THE CODE AND OBSERVE
  • 43.
  • 44. BRING NODE DOWN AND OBSERVE ON JAEGER
  • 45.
  • 46.
  • 47. Key references 1. https://www.selenium.dev/blog/2021/selenium-4-observability/ 2. https://www.selenium.dev/documentation/webdriver/remote_webdriver/ 3. https://github.com/manoj9788/tracing-selenium-grid 4. https://get-coursier.io/docs/cli-installation 5. https://www.ibm.com/docs/en/sdk-java-technology/7.1?topic=jjc-specifying-java- options-system-properties-2 6. https://github.com/SeleniumHQ/selenium/blob/selenium-4.0.0-beta- 1/java/server/src/org/openqa/selenium/grid/commands/tracing.txt 7. https://opentelemetry.io/docs/java/ 8. https://www.lambdatest.com/blog/selenium-grid-4-tutorial-for-distributed-testing/ 9. https://www.browserstack.com/guide/selenium-grid-4-tutorial 10.https://docs.docker.com/compose/environment-variables/ 11.https://github.com/SeleniumHQ/docker-selenium