Selenium 4.0 and The Future: Manoj Kumar [Testμ 2022]

Selenium 4.0 and The Future: Manoj Kumar [Testμ 2022]

Table of contents

No heading

No headings in the article.

We were eager to listen to Manoj Kumar, VP Developer Relations, LambdaTest, speak on the importance of Selenium 4.0 and how bright the future is. This was the agenda of the speech:

Selenium 4.0:

  • Relative locators.

  • DevTools protocol.

  • Web authentication.

  • Geo-location.

  • Network interception.

  • Observability.

  • The future of Selenium 4.0.

  • WebDriver Bi-Di.

  • Selenium project initiatives.

You can watch the video for more details:

He spoke on how Selenium 4.0, released in the Chinese new year, has rocked the market so far. With relative locators, also known as friendly locators, you can easily find elements tough to crack with XPath in Selenium and CSS.

You can easily locate elements using generic user terms like above, below, toLeftof, toRightof, and near.

He spoke about the case where while writing an automated script, you can use WebDriver APIs, which typically start with driver.findelement(). He said that when it’s ID/CSS/XPath, you will have to inspect the elements. Not every web page is friendly. Hence you can easily locate different elements with Selenium 4 relative locators.

Then he explained how relative locators work. He delved into how every element on the DOM consists of a Client Bounding Rect.

He spoke on how many testers are struggling with the DevTools protocol. This is useful for web form submissions, insurance quotes, payment, and summary pages. He told the crowd that the Selenium test automation tool is a lot more fun to work on, being a browser automation framework. He said it’s up to us how we make use of it.

Speaking about DevTools Protocol and WebDriver BiDi, an API that does not need you to code very often, he said:

“Selenium 4 now has relative support for Chrome DevTools Protocol through “DevTools” interface. This helps us get Chrome Development properties such as application cache, fetch, network, performance, profiler, resource timing, security, and target CDP domains.”

He further spoke on how Selenium 4.0 has brought in some features from WebDriver 4.0, a drop-in replacement, like web authentication, imitation observer, network interception, and listening into JavaScript exceptions.

He further explained how using Webdriver Bi-Di, every browser can use various browser engines. According to him, with the DevTools protocol, you can inspect and debug Chromium and blink-based browsers. You can use it to avoid challenges with a cross-browser.

Manoj believes that Selenium 4.0 has simplified web authentication since it consists of an authentication interface with the ability to automate login authentication. This can improve security against man-in-middle attacks since it authenticates passwords. In short, Manoj said that you could see the code and see how it’s being used.

“WebDriverIO is based on specifications which is nothing but the DevTools way of doing it,” said Manoj.

With the network interception feature, Manoj explained how it used HasAuthentication to capture network events and used a mock UI front-end. He mentioned that the common complaint surrounding the Selenium test is that it is slow and flaky. Even though the browser bindings are excellent, there are possible ways to go wrong. To avoid that, you can intercept the network traffic in the test and come up with a pre-canned response.

He spoke about the use cases of mocking in the API world in UI testing and using tools like Selenium. He said the UI might be ready, but the API might still be cooking. He said you could intercept the network over the HTTP call in that case and mock the images through this. This way, you can manipulate and modify any response from the browser.

Manoj also spoke on geolocation and how, with geolocation testing in Selenium 4.0, you can emulate geolocation with direct CDP API DevTools.send(). According to Manoj, this can be used to emulate any location on the map. It’s as simple as just copy-pasting the latitude and longitude.

With observability, you can use logs, metrics, and traces typically assessing the service and having standard infrastructure. He shared his experience working on these aspects and how telemetry comes into the picture. He conveyed that telemetry has been integrated into Selenium 4.0.

He then compared the architecture of Selenium 3.0 and Selenium 4.0. He said there are added session queues, session maps, routers, event buses, and so on.

Then he explained the Selenium 4.0 grid flow.

According to Manoj’s views on Observability in Selenium 4.0,

  • Selenium server is instrumented with a tracer using open telemetry.

  • Every request from the server is traced from start to end.

  • Each trace consists of a series of spans as a request is executed within the server.

  • It facilitates end-to-end tracking from client to server.

While speaking about Docker Selenium, he explained how Docker images for Selenium are built for Debian ARM64, ARM v/7, and AMD64.

He shared the good news that Selenium 4.0 came up with the “Batteries included” approach. This comes with the support of:

  • Selenium Manager- Automatically download browser drivers.

  • Selenium Java upgrade, from Java 8 to Java 11.

  • Dotnet- async/await.

  • Python- async.

  • WebDriver BiDi.

  • Selenium grid UI with analytics and artifacts.

He further conveyed how the Selenium community is coming up with many exciting plans for the team, including the Selenium “ambassador” program and Test Automation Summit.

Here are the questions our host, Sparsh Kesari, put forth to Manoj. These are his answers:

Playwright is CDP, Puppeteer is CDP, will Selenium be pure CDP?

Manoj: Absolutely not! Selenium would stand out since the way it works is very different. That’s why we are bringing in a platform called WebDrive Bi-Di.

Is Selenium 4.0 support added to LambdaTest?

Manoj: Yes, we are supporting!

How long before you think WebDrive Bi-Di becomes used as a commonplace?

Manoj: It might take some time, even though we can’t predict it exactly.

How different is the relative locator from the parent::sibling concept already available in Selenium 3?

Manoj: I have used parent::sibling at the beginning of my character. It’s a way of over-engineering and ensuring that every element works well.

With Selenium 3, is it mandatory to migrate all Selenium 3 projects?

Manoj: Yes, why not! There are many exciting features waiting for you. Hence you should consider migrating from Selenium 3.0 to Selenium 4.0.

It was indeed an insightful session with Manoj Kumar! We are glad to have the pleasure of hearing him speak about Selenium 4.0 and its future.