Introduction to Selenium 4.0 and features in Selenium 4.0

In the present scenario, we are heavily dependent on Websites and our day to day life is highly dependent on the Web. If we talk about Website and web automation then the first thing that comes into our mind is “Selenium”. Selenium is one of the popular API for Web Automation and used directly indirectly in many web automation tools.

Recently Selenium community launched Selenium 4.0 a6 Version which has many interesting features which makes you much excited to use Selenium4.0. This article helps you by providing detailed information on Selenium 4.0a6 new features.

Simon informed about Selenium 4.0a6 by tweet.

Simon Stewart is WebDriver creator and person who is leading Selenium Project.

According to Selenium 4.0a6 release doc, Selenium brings the following features and changes.

Relative Locator (Friendly Locators)

Selenium 4.0 brings new features to find web elements by element reference. This idea is taken from Sahi and also the same feature is provided in Taikoo. selenium uses Java script method Element.getBoundingClientRect() which returns the size of Element and viewport.

domRect = element.getBoundingClientRect();

This feature gives you flexibility to identify Web Element with reference of element. Refer below for list of methods:

  1. toLeftOf(): Left WebElement identified  with respect of given WebElement
  2. toRightOf(): Right Element identified  with respect of given WebElement
  3. above(): Above WebElement  identified  with respect of given WebElement
  4. below(): Below Element identified  with respect of given WebElement
  5. near(): Web Element can be identified at  50 pixels far away from the specified element. The pixel value can also be mod

W3C Protocol Adaptation

Before Selenium 3.8 release, Selenium supports only JSON Wire Protocol but from Selenium 3.8 adapted W3C protocol. In future Selenium will not support JSON Wire Protocol. W3C is well-know international standards for browser and all the browsers adopted these standards. So by adopting this Selenium will work uniformly across all the browsers. Previously we were getting issues while cross-browser execution.

Main Advantages of using this protocol are uniform execution on different browsers and stability.

Selenium Documentation

Selenium HQ website was not updated for a long time. But now Selenium Community designed a wonderful user attractive website which is updated with the latest Selenium 4.0 also each method explained in detail and also with example.

New Selenium Website: https://www.selenium.dev/

Support to Dev Tools

Selenium 4.0 added interface with ChromeDevTools. This is also known as CDP (Chrome Devtools Protocol) features. With the use of Selenium with CDP, you can do the following things.

  • Inspect
  • Debug
  • Profile Chromium
  • Perform Security Operations
  • Emulate Network
  • Get Feature of Console Log
  • Get Performance Matrixes for Browser and Network    
  • Application Cache           

Selenium Grid Upgraded

Selenium Grid is the smart proxy server that routes Selenium commands to remote browser instances. Its aims to provide an easy way to run tests in parallel on different machine browsers. Previously, Selenium Grid set up was a bit difficult but in Selenium 4.0 Grid will be more users friendly and easy to configure. Selenium Grid has basically two components one is a hub (server) and another one is nodes (clients). Nodes can be different browsers on different machines. Node and Hub communication are done by formatted JSON wire Protocol.

Selenium IDE

Selenium 4.0 is also updated Selenium IDE. Selenium IDE is used to record and play. As a part of new feature Selenium IDE can be

  • Any browser can be easily integrated with Selenium IDE.
  • New CLI provided which can be used to run Selenium IDE script from the command line.
  • New CLI supports parallel execution and will provide useful information like text execution time, number of passed test cases, and failed test cases.

Capture Screenshot of Web Element

Before Selenium 4.0, we were able to capture screenshot viewport but now Selenium 4.0 brings a wonderful method to capture screenshot of specific web elements.

Support GraphQL

Graph QL is a query language for APIs that gives complete and understandable data of your APIs and it empowers a client to fetch data using Query. Selenium 4.0 added features to test Graph QL.

Hope above article gives you detailed information about Selenium4.0 features. Refer our next tutorials for step by step implementation of Selenium 4.0 feature learning and step by step implementation.

Feel free to share your feedback on thoughtcoders2020@gmail.com.

Reference doc: https://github.com/SeleniumHQ/selenium/blob/master/rb/CHANGES#L1-L37

Read Related Blog More:

Locators in Selenium WebDriver– Types with Examples

Mouse Hover and Double Click using Selenium

Subscribe to our Newsletter:

0 0 vote
Article Rating
close

Subscribe to our Newsletter:

Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Arun
Arun
1 year ago

Very informative. Happy learning!

Thought Coders_AK
Editor
1 year ago
Reply to  Arun

Thanks Arun!!

2
0
Would love your thoughts, please comment.x
()
x
Open chat
Feel free to contact