What is selenium 4.0?
What is selenium 4.0? To begin with, 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 to remember is “Selenium”. Basically, 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 definitely helps you by providing detailed information on Selenium 4.0a6 new features.
What is selenium 4.0?
Simon informed about Selenium 4.0a6 by tweet.
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();
Even though, this feature gives you flexibility to identify Web Element with reference of element. Refer below for list of methods:
- toLeftOf(): Left WebElement identified with respect of given WebElement
- toRightOf(): Right Element identified with respect of given WebElement
- above(): Above WebElement identified with respect of given WebElement
- below(): Below Element identified with respect of given WebElement
- 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. In addition, 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.
Provided that 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. It is important to realize, with the use of Selenium with CDP, you can do the following things.
- 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. To clarify, Node and Hub communication are done by formatted JSON wire Protocol.
Selenium 4.0 is also Selenium IDE. The use of Selenium IDE is to record and play. As a part of new feature Selenium IDE can be
- Any browser that can easily integrate with Selenium IDE.
- Provide new CLI 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. What’s more?
Capture Screenshot of Web Element
Up to the present time i.e, 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.
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. With this purpose in mind, Selenium 4.0 added features to test Graph QL.
To conclude, 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.
To this end, feel free to share your feedback on firstname.lastname@example.org.
Read Related Blog More: