Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati

Agile Testing Alliance
Agile Testing AllianceAgile Testing Alliance
What's coming our
way?
- Hitesh Prajapati
AGENDA
 I n t r o d u c t i o n
 S e l e n i u m 4 F e a t u r e s
 Relative Locators (Friendly Locators
Prev.)
 Capturing Element Screenshot
 Windows/Tab Handling
 Chrome Dev Tools
 Selenium Grid
 T r a n s i t i o n f r o m 3 . X t o 4 . X
 Q & A
2
3
3
INTRODUCTION
4
SELENIUM 4 : WHAT’S
NEW?
 Relative Locators (Friendly
Locators Prev.)
 Capturing Element Screenshot
 Windows/Tab Handling
 Chrome Dev Tools
 Selenium Grid
5
RELATIVE LOCATORS
• Above
• Below
• ToLeftOf
• ToRightOf
• Near
6
RELATIVE LOCATORS : BAD
EXAMPLE
Link To Source Code
7
RELATIVE LOCATORS : BAD EXAMPLE -
RESULT
8
RELATIVE LOCATORS : GOOD
EXAMPLE
Link To Source Code
9
RELATIVE LOCATORS : GOOD EXAMPLE -
RESULT
10
11
TECH
STACK
12
RELATIVE LOCATORS : HOW DOES IT
WORK?
 Selenium uses the JavaScript function getBoundingClientRect() to find the relative
elements
 The Element.getBoundingClientRect() method returns a DOMRect object providing information
about the size of an element and its position relative to the viewport.
 The returned DOMRect value contains the left, top, right, bottom, x, y, width and height.
 In case of near(), it makes use of getBoundingClientRect() and tries to locate an element
which is at most 50px away from the specified element.
 The overloaded method of near(), let’s you override default behavior of locating an
element (which is 50px) by passing pixels value that you want to use.
RelativeLocator.withTagName().near()
https://www.selenium.dev/documentation/en/getting_started_with_webdriver/locating
13
RELATIVE LOCATORS : HOW DOES IT
WORK?
Syntax
https://developer.mozilla.org/en-
14
CAPTURING ELEMENT SCREENSHOT
Link To Source
15
WINDOW HANDLING
16
TAB HANDLING
17
CHROME DEV
TOOLS
 Basic Authentication
 Access Console Logs
 Mocking Geo-Location
 Load In-Secure Web Sites
 Block Specific Resources/URLs
 Simulate Network Speed
 Simulate Device Mode
 Changing User Agents
 Capture HTTP Requests
 Simulate Time Zones
18
WHAT’S CHANGED?
ChromeDriver / EdgeDriver 
RemoteWebDriver
Selenium 3.x
Selenium 4.x ChromeDriver / EdgeDriver  ChromiumDriver 
RemoteWebDriver
19
WHAT’S CHANGED?
ChromeDriver  ChromiumDriver 
RemoteWebDriver
https://github.com/SeleniumHQ/selenium/tree/trunk/java/client/src/org/openqa/sele
20
CDP : BASIC AUTHENTICATION
http://UserName:Password@WebSiteUrl
Selenium 3.x
Selenium 4.x
Chrome DevTools Protocol : Network
21
CDP : ACCESS CONSOLE LOGS
Chrome DevTools Protocol : Log Domain
22
CDP : MOCK GEO-LOCATION
Chrome DevTools Protocol : Emulation
23
CDP : LOAD INSECURE WEBSITES
Chrome DevTools Protocol : Security
24
CDP : BLOCK SPECIFIC RESOURCE /
URL
Chrome DevTools Protocol : Network
25
CDP : SIMULATE NETWORK SPEED
Chrome DevTools Protocol : Network
26
CDP : SIMULATE DEVICE MODE
Chrome DevTools Protocol : Emulation
27
CDP : CHANGING USER AGENTS
https://www.whoishostingthis.com/tools/user-
The user agent application - is Mozilla version 5.0, or a piece of software compatible with
it.
The operating system - is OS X version 10.2.2 (and is running on a Mac).
The client - is Chrome version 51.0.2704.84 and is based on Safari version 537.36.
The engine - responsible for displaying content on this device is AppleWebKit version
537.36 (and KHTML, an open-source layout engine, is present too).
What is User Agent?
The user agent string contains information about the user’s web browser name, operating
system, device type, and other information.
Take this UA string as an example :
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
28
CDP : CHANGING USER AGENTS
User Agent String
Chrome DevTools Protocol : Network
29
CDP : CAPTURE HTTP REQUESTS
Chrome DevTools Protocol : Network
30
CDP : SIMULATE TIME-ZONE
Chrome DevTools Protocol : Emulation
TRANSITION
FROM 3.X TO
4.X
31
32
SELENIUM 3 ARCHITECTURE
Selenium Language
Bindings
JSON
Wire
Protoco
l
elenium Clients
ChromeDr
iver
FirefoxD
river
EdgeDriv
er
SafariDr
iver
OperaDri
ver
Browser Drivers Real Browsers
Server
HTTP
Request(s)
HTTP
Response(s)
Over HTTP Server
HTTP
Protocol
REST
APIs
https://github.com/SeleniumHQ/selenium/wi
ki/JsonWireProtocol
200 OK
W3C WEB-DRIVER
SPECIFICATION
https://www.w3.org/TR/webdriver
2/
 W h a t i s W 3 C ?
 W h y W 3 C ?
 W h a t i s W 3 C W e b D r i v e r
S p e c i f i c a t i o n ?
Selenium W3C WebDriver protocol defines the
ways that browser actions are executed.
WebDriver is a remote control interface that
enables introspection and control of user
agents. It provides a platform and language-
neutral wire protocol as a way for out-of-
34
SELENIUM 4 ARCHITECTURE
Selenium Language
Bindings
W3C
Protoc
ol
Selenium Clients
ChromeDr
iver
FirefoxD
river
EdgeDriv
er
SafariDr
iver
Browser Drivers Real Browsers
Server
https://www.w3.org/TR/we
bdriver2/
35
TRANSITION FROM 3.X TO 4.X : WHAT’S
CHANGED?
>= 3.8.0 to
3.141.59
>= 4.X
<
3.8
Protocol
ChromeDriv
er
<
v75.x
>=
v75.x
>=
v75.x
GeckoDrive
r
<
v47.x
>=
v47.x
>=
v47.x
<
v47.x
https://firefox-source-
(SE <
v3.11)
(SE >=
v3.11)
36
SELENIUM 4.0 : WEB-DRIVER TEST
RESULTS
http://webdriver-herald.herokuapp.com/
37
ADVANTAGES OF W3C -
WD
 Standards
• Your tests should run more
consistently between browsers
because this is a standard that
all browser vendors will
develop. This means common code
for all browsers.
 Stability
• More stable test case execution
• Less number of exceptions while
executing tests across various
browsers.
38
TRANSITION FROM 3.X TO 4.X : ACTION
API
< v4.x
package
org.openqa.selenium.interactions
Click
>=
v4.x
.moveToElement(WebElement).click() .click(WebElement)
Click And
Hold
.moveToElement(WebElement).clickAndHold() .clickAndHold(WebElement)
Context
Click
.moveToElement(WebElement).contextClick() .contextClick(WebElement)
Double
Click
.moveToElement(WebElement).doubleClick() .doubleClick(WebElement)
Release Left
Mouse
.moveToElement(WebElement).release() .release(WebElement)
https://www.selenium.dev/selenium/docs/api/java/index
39
40
41
REFERENCES
Demo Source Code : https://github.com/HItesh007/selenium4-
demo
Relative Locator :
https://www.selenium.dev/documentation/en/getting_started_with_webdriver/locati
ng_elements/
Bounding Client Doc : https://developer.mozilla.org/en-
US/docs/Web/API/Element/getBoundingClientRect
Network Domain : https://chromedevtools.github.io/devtools-
protocol/tot/Network/
Log Domain : https://chromedevtools.github.io/devtools-
protocol/tot/Log/
Emulation Domain :
https://chromedevtools.github.io/devtools-
protocol/tot/Emulation/
Security Domain :
Chrome Dev Tools
Documentation
JSON Wire Protocol :
https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol
W3C WebDriver Specification : https://www.w3.org/TR/webdriver2/
Selenium 4 - WD Test Results : http://webdriver-herald.herokuapp.com/
Selenium 4 – Deprecated List :
https://www.selenium.dev/selenium/docs/api/java/index.html?deprecated-
list.html
User Agent : https://www.whoishostingthis.com/tools/user-agent/
Explore User Agent String :
https://developers.whatismybrowser.com/useragents/explore/
THANK YOU
H I T E S H P R A J A P A T I
h i t e s h p r a j a p a t i 1 9 9 2 @ g m a i
l . c o m
/ i n / h i t e s h p r a j a p a t i 0 0 7 /
/ H I t e s h 0 0 7
/ H i t e s h _ p r a j a p a t i 1 9 9 2
1 of 42

Recommended

Session on Launching Selenium Grid and Running tests using docker compose and... by
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...Agile Testing Alliance
247 views28 slides
Session on Selenium Powertools by Unmesh Gundecha by
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
153 views28 slides
Selenium 4 with Simon Stewart [Webinar] by
Selenium 4 with Simon Stewart [Webinar]Selenium 4 with Simon Stewart [Webinar]
Selenium 4 with Simon Stewart [Webinar]BrowserStack
4.3K views50 slides
Automated testing with Drupal by
Automated testing with DrupalAutomated testing with Drupal
Automated testing with DrupalPromet Source
7.4K views31 slides
Mastering selenium for automated acceptance tests by
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsNick Belhomme
20.1K views59 slides
Automatic Functional Testing with Selenium and SauceLabs by
Automatic Functional Testing with Selenium and SauceLabsAutomatic Functional Testing with Selenium and SauceLabs
Automatic Functional Testing with Selenium and SauceLabsJoseph Chiang
2.3K views25 slides

More Related Content

What's hot

Selenium by
SeleniumSelenium
Seleniumjagdishdevabhaipatel
4.1K views46 slides
Jenkins & Selenium by
Jenkins & SeleniumJenkins & Selenium
Jenkins & Seleniumadamcarmi
2.3K views9 slides
Play Framework: The Basics by
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The BasicsPhilip Langer
7.2K views45 slides
Get Started With Selenium 3 and Selenium 3 Grid by
Get Started With Selenium 3 and Selenium 3 GridGet Started With Selenium 3 and Selenium 3 Grid
Get Started With Selenium 3 and Selenium 3 GridDaniel Herken
2.8K views28 slides
Automated UI testing. Selenium. DrupalCamp Kyiv 2011 by
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Yuriy Gerasimov
3.2K views16 slides
Selenium with java by
Selenium with javaSelenium with java
Selenium with javaSatyam Pandey
508 views9 slides

What's hot(20)

Jenkins & Selenium by adamcarmi
Jenkins & SeleniumJenkins & Selenium
Jenkins & Selenium
adamcarmi2.3K views
Play Framework: The Basics by Philip Langer
Play Framework: The BasicsPlay Framework: The Basics
Play Framework: The Basics
Philip Langer7.2K views
Get Started With Selenium 3 and Selenium 3 Grid by Daniel Herken
Get Started With Selenium 3 and Selenium 3 GridGet Started With Selenium 3 and Selenium 3 Grid
Get Started With Selenium 3 and Selenium 3 Grid
Daniel Herken2.8K views
Automated UI testing. Selenium. DrupalCamp Kyiv 2011 by Yuriy Gerasimov
Automated UI testing. Selenium. DrupalCamp Kyiv 2011Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Automated UI testing. Selenium. DrupalCamp Kyiv 2011
Yuriy Gerasimov3.2K views
前端網頁自動測試 by 政億 林
前端網頁自動測試 前端網頁自動測試
前端網頁自動測試
政億 林4.4K views
Upgrading to Selenium WebDriver version 3 by Alan Richardson
Upgrading to Selenium WebDriver version 3Upgrading to Selenium WebDriver version 3
Upgrading to Selenium WebDriver version 3
Alan Richardson5K views
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS! by Puneet Kala
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Puneet Kala2.6K views
Smarter ways to do selenium automation @ work, Selenium, automation by RIA RUI Society
Smarter ways to do selenium automation @ work, Selenium, automationSmarter ways to do selenium automation @ work, Selenium, automation
Smarter ways to do selenium automation @ work, Selenium, automation
RIA RUI Society12.5K views
How to Configure Selenium WebDriver (java) by Dasun Eranthika
How to Configure Selenium WebDriver (java)How to Configure Selenium WebDriver (java)
How to Configure Selenium WebDriver (java)
Dasun Eranthika7.1K views
Web Test Automation with Selenium by vivek_prahlad
Web Test Automation with SeleniumWeb Test Automation with Selenium
Web Test Automation with Selenium
vivek_prahlad26.5K views

Similar to Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati

Selenium.pptx by
Selenium.pptxSelenium.pptx
Selenium.pptxPandiya Rajan
8 views42 slides
Robot Framework Introduction & Sauce Labs Integration by
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs IntegrationSauce Labs
10.9K views19 slides
Building Web Sites that Work Everywhere by
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work EverywhereDoris Chen
3.1K views42 slides
2013 10-10 selenium presentation to ocjug by
2013 10-10 selenium presentation to ocjug2013 10-10 selenium presentation to ocjug
2013 10-10 selenium presentation to ocjugPhilip Schlesinger
681 views28 slides
Web UI Tests: Introduce UI tests using Selenium by
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium Peyman Fakharian
88 views26 slides
Selenium Introduction and IDE by
Selenium Introduction and IDESelenium Introduction and IDE
Selenium Introduction and IDEMurageppa-QA
160 views59 slides

Similar to Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati(20)

Robot Framework Introduction & Sauce Labs Integration by Sauce Labs
Robot Framework Introduction & Sauce Labs IntegrationRobot Framework Introduction & Sauce Labs Integration
Robot Framework Introduction & Sauce Labs Integration
Sauce Labs10.9K views
Building Web Sites that Work Everywhere by Doris Chen
Building Web Sites that Work EverywhereBuilding Web Sites that Work Everywhere
Building Web Sites that Work Everywhere
Doris Chen3.1K views
Web UI Tests: Introduce UI tests using Selenium by Peyman Fakharian
Web UI Tests: Introduce UI tests using Selenium Web UI Tests: Introduce UI tests using Selenium
Web UI Tests: Introduce UI tests using Selenium
Peyman Fakharian88 views
Selenium Introduction and IDE by Murageppa-QA
Selenium Introduction and IDESelenium Introduction and IDE
Selenium Introduction and IDE
Murageppa-QA160 views
Codeception by 少東 張
CodeceptionCodeception
Codeception
少東 張3.7K views
Mike Taulty MIX10 Silverlight Frameworks and Patterns by ukdpe
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
ukdpe717 views
Selenium Tutorial for Beginners - TIB Academy by TIB Academy
Selenium Tutorial for Beginners - TIB AcademySelenium Tutorial for Beginners - TIB Academy
Selenium Tutorial for Beginners - TIB Academy
TIB Academy25 views
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup by Dave Haeffner
Selenium Tips & Tricks, presented at the Tel Aviv Selenium MeetupSelenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
Dave Haeffner3.9K views
The DevOps Journey by Micro Focus
The DevOps JourneyThe DevOps Journey
The DevOps Journey
Micro Focus 1.3K views
Selenium training for beginners by TIB Academy
Selenium training for beginnersSelenium training for beginners
Selenium training for beginners
TIB Academy59 views
Mobile Test Automation using one API and one infrastructure by Michael Palotas
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
Michael Palotas902 views
selenium-webdriver-interview-questions.pdf by AnuragMourya8
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
AnuragMourya88 views
Test Automation Using Selenium by Nikhil Kapoor
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
Nikhil Kapoor211 views
Building Rich Applications with Appcelerator by Matt Raible
Building Rich Applications with AppceleratorBuilding Rich Applications with Appcelerator
Building Rich Applications with Appcelerator
Matt Raible2.6K views

More from Agile Testing Alliance

Parallel Test execution in Cypress with CI/CD by
Parallel Test execution in Cypress with CI/CDParallel Test execution in Cypress with CI/CD
Parallel Test execution in Cypress with CI/CDAgile Testing Alliance
6 views10 slides
Localisation Testing using UI automation by
Localisation Testing using UI automationLocalisation Testing using UI automation
Localisation Testing using UI automationAgile Testing Alliance
8 views13 slides
AI in UI automation using Helenium by
AI in UI automation using HeleniumAI in UI automation using Helenium
AI in UI automation using HeleniumAgile Testing Alliance
13 views12 slides
Automation for test data anonymization by
Automation for test data anonymizationAutomation for test data anonymization
Automation for test data anonymizationAgile Testing Alliance
6 views9 slides
MobSF: Mobile Security Testing (Android/IoS) by
MobSF: Mobile Security Testing (Android/IoS)MobSF: Mobile Security Testing (Android/IoS)
MobSF: Mobile Security Testing (Android/IoS)Agile Testing Alliance
35 views11 slides
AI-Automation-Using-Computer-Vision-in-Testing.pptx by
AI-Automation-Using-Computer-Vision-in-Testing.pptxAI-Automation-Using-Computer-Vision-in-Testing.pptx
AI-Automation-Using-Computer-Vision-in-Testing.pptxAgile Testing Alliance
15 views9 slides

More from Agile Testing Alliance(20)

#ATAHyderabad Meetup Welcome Session and Introductions Adi.pptx by Agile Testing Alliance
#ATAHyderabad Meetup Welcome Session and Introductions Adi.pptx#ATAHyderabad Meetup Welcome Session and Introductions Adi.pptx
#ATAHyderabad Meetup Welcome Session and Introductions Adi.pptx
#ATAGTR2021 Presentation : "Use of AI and ML in Performance Testing" by Adolf... by Agile Testing Alliance
#ATAGTR2021 Presentation : "Use of AI and ML in Performance Testing" by Adolf...#ATAGTR2021 Presentation : "Use of AI and ML in Performance Testing" by Adolf...
#ATAGTR2021 Presentation : "Use of AI and ML in Performance Testing" by Adolf...
#ATAGTR2021 Presentation : "Common Testing Mistakes –Are we really evolving?... by Agile Testing Alliance
#ATAGTR2021 Presentation :  "Common Testing Mistakes –Are we really evolving?...#ATAGTR2021 Presentation :  "Common Testing Mistakes –Are we really evolving?...
#ATAGTR2021 Presentation : "Common Testing Mistakes –Are we really evolving?...
#ATAGTR2021 Presentation : "Chaos engineering: Break it to make it" by Anupa... by Agile Testing Alliance
#ATAGTR2021 Presentation :  "Chaos engineering: Break it to make it" by Anupa...#ATAGTR2021 Presentation :  "Chaos engineering: Break it to make it" by Anupa...
#ATAGTR2021 Presentation : "Chaos engineering: Break it to make it" by Anupa...
#ATAGTR2021 Presentation : "Unlocking the Power of Machine Learning in the Mo... by Agile Testing Alliance
#ATAGTR2021 Presentation : "Unlocking the Power of Machine Learning in the Mo...#ATAGTR2021 Presentation : "Unlocking the Power of Machine Learning in the Mo...
#ATAGTR2021 Presentation : "Unlocking the Power of Machine Learning in the Mo...
#ATAGTR2021 Presentation : "Performance Evaluation Strategy of multi-access e... by Agile Testing Alliance
#ATAGTR2021 Presentation : "Performance Evaluation Strategy of multi-access e...#ATAGTR2021 Presentation : "Performance Evaluation Strategy of multi-access e...
#ATAGTR2021 Presentation : "Performance Evaluation Strategy of multi-access e...
#ATAGTR2021 Presentation : "Spice up your Testing Gamify it out!" by Geosley ... by Agile Testing Alliance
#ATAGTR2021 Presentation : "Spice up your Testing Gamify it out!" by Geosley ...#ATAGTR2021 Presentation : "Spice up your Testing Gamify it out!" by Geosley ...
#ATAGTR2021 Presentation : "Spice up your Testing Gamify it out!" by Geosley ...

Recently uploaded

Tunable Laser (1).pptx by
Tunable Laser (1).pptxTunable Laser (1).pptx
Tunable Laser (1).pptxHajira Mahmood
23 views37 slides
Future of Learning - Yap Aye Wee.pdf by
Future of Learning - Yap Aye Wee.pdfFuture of Learning - Yap Aye Wee.pdf
Future of Learning - Yap Aye Wee.pdfNUS-ISS
41 views11 slides
DALI Basics Course 2023 by
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023Ivory Egg
14 views12 slides
Attacking IoT Devices from a Web Perspective - Linux Day by
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day Simone Onofri
15 views68 slides
Roadmap to Become Experts.pptx by
Roadmap to Become Experts.pptxRoadmap to Become Experts.pptx
Roadmap to Become Experts.pptxdscwidyatamanew
11 views45 slides

Recently uploaded(20)

Future of Learning - Yap Aye Wee.pdf by NUS-ISS
Future of Learning - Yap Aye Wee.pdfFuture of Learning - Yap Aye Wee.pdf
Future of Learning - Yap Aye Wee.pdf
NUS-ISS41 views
DALI Basics Course 2023 by Ivory Egg
DALI Basics Course  2023DALI Basics Course  2023
DALI Basics Course 2023
Ivory Egg14 views
Attacking IoT Devices from a Web Perspective - Linux Day by Simone Onofri
Attacking IoT Devices from a Web Perspective - Linux Day Attacking IoT Devices from a Web Perspective - Linux Day
Attacking IoT Devices from a Web Perspective - Linux Day
Simone Onofri15 views
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze by NUS-ISS
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng TszeDigital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
Digital Product-Centric Enterprise and Enterprise Architecture - Tan Eng Tsze
NUS-ISS19 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10209 views
Web Dev - 1 PPT.pdf by gdsczhcet
Web Dev - 1 PPT.pdfWeb Dev - 1 PPT.pdf
Web Dev - 1 PPT.pdf
gdsczhcet55 views
handbook for web 3 adoption.pdf by Liveplex
handbook for web 3 adoption.pdfhandbook for web 3 adoption.pdf
handbook for web 3 adoption.pdf
Liveplex19 views
Igniting Next Level Productivity with AI-Infused Data Integration Workflows by Safe Software
Igniting Next Level Productivity with AI-Infused Data Integration Workflows Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Safe Software225 views
PharoJS - Zürich Smalltalk Group Meetup November 2023 by Noury Bouraqadi
PharoJS - Zürich Smalltalk Group Meetup November 2023PharoJS - Zürich Smalltalk Group Meetup November 2023
PharoJS - Zürich Smalltalk Group Meetup November 2023
Noury Bouraqadi120 views
Future of Learning - Khoong Chan Meng by NUS-ISS
Future of Learning - Khoong Chan MengFuture of Learning - Khoong Chan Meng
Future of Learning - Khoong Chan Meng
NUS-ISS33 views
[2023] Putting the R! in R&D.pdf by Eleanor McHugh
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh38 views
Perth MeetUp November 2023 by Michael Price
Perth MeetUp November 2023 Perth MeetUp November 2023
Perth MeetUp November 2023
Michael Price15 views
AMAZON PRODUCT RESEARCH.pdf by JerikkLaureta
AMAZON PRODUCT RESEARCH.pdfAMAZON PRODUCT RESEARCH.pdf
AMAZON PRODUCT RESEARCH.pdf
JerikkLaureta15 views
Combining Orchestration and Choreography for a Clean Architecture by ThomasHeinrichs1
Combining Orchestration and Choreography for a Clean ArchitectureCombining Orchestration and Choreography for a Clean Architecture
Combining Orchestration and Choreography for a Clean Architecture
ThomasHeinrichs169 views
How the World's Leading Independent Automotive Distributor is Reinventing Its... by NUS-ISS
How the World's Leading Independent Automotive Distributor is Reinventing Its...How the World's Leading Independent Automotive Distributor is Reinventing Its...
How the World's Leading Independent Automotive Distributor is Reinventing Its...
NUS-ISS15 views

Session on Selenium 4 : What’s coming our way? by Hitesh Prajapati

  • 1. What's coming our way? - Hitesh Prajapati
  • 2. AGENDA  I n t r o d u c t i o n  S e l e n i u m 4 F e a t u r e s  Relative Locators (Friendly Locators Prev.)  Capturing Element Screenshot  Windows/Tab Handling  Chrome Dev Tools  Selenium Grid  T r a n s i t i o n f r o m 3 . X t o 4 . X  Q & A 2
  • 4. 4 SELENIUM 4 : WHAT’S NEW?  Relative Locators (Friendly Locators Prev.)  Capturing Element Screenshot  Windows/Tab Handling  Chrome Dev Tools  Selenium Grid
  • 5. 5 RELATIVE LOCATORS • Above • Below • ToLeftOf • ToRightOf • Near
  • 6. 6 RELATIVE LOCATORS : BAD EXAMPLE Link To Source Code
  • 7. 7 RELATIVE LOCATORS : BAD EXAMPLE - RESULT
  • 8. 8 RELATIVE LOCATORS : GOOD EXAMPLE Link To Source Code
  • 9. 9 RELATIVE LOCATORS : GOOD EXAMPLE - RESULT
  • 10. 10
  • 12. 12 RELATIVE LOCATORS : HOW DOES IT WORK?  Selenium uses the JavaScript function getBoundingClientRect() to find the relative elements  The Element.getBoundingClientRect() method returns a DOMRect object providing information about the size of an element and its position relative to the viewport.  The returned DOMRect value contains the left, top, right, bottom, x, y, width and height.  In case of near(), it makes use of getBoundingClientRect() and tries to locate an element which is at most 50px away from the specified element.  The overloaded method of near(), let’s you override default behavior of locating an element (which is 50px) by passing pixels value that you want to use. RelativeLocator.withTagName().near() https://www.selenium.dev/documentation/en/getting_started_with_webdriver/locating
  • 13. 13 RELATIVE LOCATORS : HOW DOES IT WORK? Syntax https://developer.mozilla.org/en-
  • 17. 17 CHROME DEV TOOLS  Basic Authentication  Access Console Logs  Mocking Geo-Location  Load In-Secure Web Sites  Block Specific Resources/URLs  Simulate Network Speed  Simulate Device Mode  Changing User Agents  Capture HTTP Requests  Simulate Time Zones
  • 18. 18 WHAT’S CHANGED? ChromeDriver / EdgeDriver  RemoteWebDriver Selenium 3.x Selenium 4.x ChromeDriver / EdgeDriver  ChromiumDriver  RemoteWebDriver
  • 19. 19 WHAT’S CHANGED? ChromeDriver  ChromiumDriver  RemoteWebDriver https://github.com/SeleniumHQ/selenium/tree/trunk/java/client/src/org/openqa/sele
  • 20. 20 CDP : BASIC AUTHENTICATION http://UserName:Password@WebSiteUrl Selenium 3.x Selenium 4.x Chrome DevTools Protocol : Network
  • 21. 21 CDP : ACCESS CONSOLE LOGS Chrome DevTools Protocol : Log Domain
  • 22. 22 CDP : MOCK GEO-LOCATION Chrome DevTools Protocol : Emulation
  • 23. 23 CDP : LOAD INSECURE WEBSITES Chrome DevTools Protocol : Security
  • 24. 24 CDP : BLOCK SPECIFIC RESOURCE / URL Chrome DevTools Protocol : Network
  • 25. 25 CDP : SIMULATE NETWORK SPEED Chrome DevTools Protocol : Network
  • 26. 26 CDP : SIMULATE DEVICE MODE Chrome DevTools Protocol : Emulation
  • 27. 27 CDP : CHANGING USER AGENTS https://www.whoishostingthis.com/tools/user- The user agent application - is Mozilla version 5.0, or a piece of software compatible with it. The operating system - is OS X version 10.2.2 (and is running on a Mac). The client - is Chrome version 51.0.2704.84 and is based on Safari version 537.36. The engine - responsible for displaying content on this device is AppleWebKit version 537.36 (and KHTML, an open-source layout engine, is present too). What is User Agent? The user agent string contains information about the user’s web browser name, operating system, device type, and other information. Take this UA string as an example : Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
  • 28. 28 CDP : CHANGING USER AGENTS User Agent String Chrome DevTools Protocol : Network
  • 29. 29 CDP : CAPTURE HTTP REQUESTS Chrome DevTools Protocol : Network
  • 30. 30 CDP : SIMULATE TIME-ZONE Chrome DevTools Protocol : Emulation
  • 32. 32 SELENIUM 3 ARCHITECTURE Selenium Language Bindings JSON Wire Protoco l elenium Clients ChromeDr iver FirefoxD river EdgeDriv er SafariDr iver OperaDri ver Browser Drivers Real Browsers Server HTTP Request(s) HTTP Response(s) Over HTTP Server HTTP Protocol REST APIs https://github.com/SeleniumHQ/selenium/wi ki/JsonWireProtocol 200 OK
  • 33. W3C WEB-DRIVER SPECIFICATION https://www.w3.org/TR/webdriver 2/  W h a t i s W 3 C ?  W h y W 3 C ?  W h a t i s W 3 C W e b D r i v e r S p e c i f i c a t i o n ? Selenium W3C WebDriver protocol defines the ways that browser actions are executed. WebDriver is a remote control interface that enables introspection and control of user agents. It provides a platform and language- neutral wire protocol as a way for out-of-
  • 34. 34 SELENIUM 4 ARCHITECTURE Selenium Language Bindings W3C Protoc ol Selenium Clients ChromeDr iver FirefoxD river EdgeDriv er SafariDr iver Browser Drivers Real Browsers Server https://www.w3.org/TR/we bdriver2/
  • 35. 35 TRANSITION FROM 3.X TO 4.X : WHAT’S CHANGED? >= 3.8.0 to 3.141.59 >= 4.X < 3.8 Protocol ChromeDriv er < v75.x >= v75.x >= v75.x GeckoDrive r < v47.x >= v47.x >= v47.x < v47.x https://firefox-source- (SE < v3.11) (SE >= v3.11)
  • 36. 36 SELENIUM 4.0 : WEB-DRIVER TEST RESULTS http://webdriver-herald.herokuapp.com/
  • 37. 37 ADVANTAGES OF W3C - WD  Standards • Your tests should run more consistently between browsers because this is a standard that all browser vendors will develop. This means common code for all browsers.  Stability • More stable test case execution • Less number of exceptions while executing tests across various browsers.
  • 38. 38 TRANSITION FROM 3.X TO 4.X : ACTION API < v4.x package org.openqa.selenium.interactions Click >= v4.x .moveToElement(WebElement).click() .click(WebElement) Click And Hold .moveToElement(WebElement).clickAndHold() .clickAndHold(WebElement) Context Click .moveToElement(WebElement).contextClick() .contextClick(WebElement) Double Click .moveToElement(WebElement).doubleClick() .doubleClick(WebElement) Release Left Mouse .moveToElement(WebElement).release() .release(WebElement) https://www.selenium.dev/selenium/docs/api/java/index
  • 39. 39
  • 40. 40
  • 41. 41 REFERENCES Demo Source Code : https://github.com/HItesh007/selenium4- demo Relative Locator : https://www.selenium.dev/documentation/en/getting_started_with_webdriver/locati ng_elements/ Bounding Client Doc : https://developer.mozilla.org/en- US/docs/Web/API/Element/getBoundingClientRect Network Domain : https://chromedevtools.github.io/devtools- protocol/tot/Network/ Log Domain : https://chromedevtools.github.io/devtools- protocol/tot/Log/ Emulation Domain : https://chromedevtools.github.io/devtools- protocol/tot/Emulation/ Security Domain : Chrome Dev Tools Documentation JSON Wire Protocol : https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol W3C WebDriver Specification : https://www.w3.org/TR/webdriver2/ Selenium 4 - WD Test Results : http://webdriver-herald.herokuapp.com/ Selenium 4 – Deprecated List : https://www.selenium.dev/selenium/docs/api/java/index.html?deprecated- list.html User Agent : https://www.whoishostingthis.com/tools/user-agent/ Explore User Agent String : https://developers.whatismybrowser.com/useragents/explore/
  • 42. THANK YOU H I T E S H P R A J A P A T I h i t e s h p r a j a p a t i 1 9 9 2 @ g m a i l . c o m / i n / h i t e s h p r a j a p a t i 0 0 7 / / H I t e s h 0 0 7 / H i t e s h _ p r a j a p a t i 1 9 9 2