SlideShare ist ein Scribd-Unternehmen logo
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

Weitere ähnliche Inhalte

Ähnlich wie Selenium 4 - What's coming our way - v1.0.pptx

Vorlon.js
Vorlon.jsVorlon.js
Vorlon.js
David Catuhe
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
ukdpe
 
Selenium Tutorial for Beginners - TIB Academy
Selenium Tutorial for Beginners - TIB AcademySelenium Tutorial for Beginners - TIB Academy
Selenium Tutorial for Beginners - TIB Academy
TIB Academy
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
Arjun Kumawat
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
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 Haeffner
 
Stetho demo
Stetho demoStetho demo
The DevOps Journey
The DevOps JourneyThe DevOps Journey
The DevOps Journey
Micro Focus
 
Lamp Zend Security
Lamp Zend SecurityLamp Zend Security
Lamp Zend Security
Ram Srivastava
 
Selenium training for beginners
Selenium training for beginnersSelenium training for beginners
Selenium training for beginners
TIB Academy
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
Agile Testing Alliance
 
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
Michael Palotas
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
AnuragMourya8
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
Nikhil Kapoor
 
Selenium
SeleniumSelenium
Selenium
Ruturaj Doshi
 
Building Rich Applications with Appcelerator
Building Rich Applications with AppceleratorBuilding Rich Applications with Appcelerator
Building Rich Applications with Appcelerator
Matt Raible
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
SpringPeople
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
Vijayan Reddy
 
Selenium
SeleniumSelenium
Selenium
Sun Technlogies
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
orbitprojects
 
Innoplexia DevTools to Crawl Webpages
Innoplexia DevTools to Crawl WebpagesInnoplexia DevTools to Crawl Webpages
Innoplexia DevTools to Crawl Webpages
d0x
 

Ähnlich wie Selenium 4 - What's coming our way - v1.0.pptx (20)

Vorlon.js
Vorlon.jsVorlon.js
Vorlon.js
 
Mike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and PatternsMike Taulty MIX10 Silverlight Frameworks and Patterns
Mike Taulty MIX10 Silverlight Frameworks and Patterns
 
Selenium Tutorial for Beginners - TIB Academy
Selenium Tutorial for Beginners - TIB AcademySelenium Tutorial for Beginners - TIB Academy
Selenium Tutorial for Beginners - TIB Academy
 
My Saminar On Php
My Saminar On PhpMy Saminar On Php
My Saminar On Php
 
Selenium Tips & Tricks, presented at the Tel Aviv Selenium Meetup
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
 
Stetho demo
Stetho demoStetho demo
Stetho demo
 
The DevOps Journey
The DevOps JourneyThe DevOps Journey
The DevOps Journey
 
Lamp Zend Security
Lamp Zend SecurityLamp Zend Security
Lamp Zend Security
 
Selenium training for beginners
Selenium training for beginnersSelenium training for beginners
Selenium training for beginners
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
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
 
selenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdfselenium-webdriver-interview-questions.pdf
selenium-webdriver-interview-questions.pdf
 
Test Automation Using Selenium
Test Automation Using SeleniumTest Automation Using Selenium
Test Automation Using Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Building Rich Applications with Appcelerator
Building Rich Applications with AppceleratorBuilding Rich Applications with Appcelerator
Building Rich Applications with Appcelerator
 
Mastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium SuccessfullyMastering Test Automation: How To Use Selenium Successfully
Mastering Test Automation: How To Use Selenium Successfully
 
Stepin evening presented
Stepin evening presentedStepin evening presented
Stepin evening presented
 
Selenium
SeleniumSelenium
Selenium
 
Selenium.pptx
Selenium.pptxSelenium.pptx
Selenium.pptx
 
Innoplexia DevTools to Crawl Webpages
Innoplexia DevTools to Crawl WebpagesInnoplexia DevTools to Crawl Webpages
Innoplexia DevTools to Crawl Webpages
 

Kürzlich hochgeladen

BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
shahdabdulbaset
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
MiscAnnoy1
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
21UME003TUSHARDEB
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
gowrishankartb2005
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
GauravCar
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
AjmalKhan50578
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
Madan Karki
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
Las Vegas Warehouse
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
RamonNovais6
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
insn4465
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
sachin chaurasia
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 

Kürzlich hochgeladen (20)

BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Mechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdfMechanical Engineering on AAI Summer Training Report-003.pdf
Mechanical Engineering on AAI Summer Training Report-003.pdf
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Material for memory and display system h
Material for memory and display system hMaterial for memory and display system h
Material for memory and display system h
 
artificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptxartificial intelligence and data science contents.pptx
artificial intelligence and data science contents.pptx
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Welding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdfWelding Metallurgy Ferrous Materials.pdf
Welding Metallurgy Ferrous Materials.pdf
 
john krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptxjohn krisinger-the science and history of the alcoholic beverage.pptx
john krisinger-the science and history of the alcoholic beverage.pptx
 
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have oneISPM 15 Heat Treated Wood Stamps and why your shipping must have one
ISPM 15 Heat Treated Wood Stamps and why your shipping must have one
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURSCompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
CompEx~Manual~1210 (2).pdf COMPEX GAS AND VAPOURS
 
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
哪里办理(csu毕业证书)查尔斯特大学毕业证硕士学历原版一模一样
 
The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.The Python for beginners. This is an advance computer language.
The Python for beginners. This is an advance computer language.
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 

Selenium 4 - What's coming our way - v1.0.pptx

  • 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