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.
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:
- 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. 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 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.
- 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 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.
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 email@example.com.
Read Related Blog More: