Selenium 4 – What's New and How you Can Use it!

Rate this content
Bookmark

Selenium 4 is out and going forward Selenium Webdriver will be completely W3C standardized. Browsers such as Chrome, Safari, Firefox, IE and Edge follow W3C standardization, bringing more standard and stability around selenium commands working uniformly across different real browsers.


Join David Burns, Core Contributor to Selenium as he talks about how this would impact your tests and about the brilliant new features that you can start using straight away. David will show how you can access a site protected basic authentication, identify a DOM mutation, get JS errors or console messages as they happen, use new Print and Window APIs to help with your testing and more.

This talk has been presented at TestJS Summit 2021, check out the latest edition of this JavaScript Conference.

FAQ

Selenium 4 introduces several new features including relative locators, new window APIs, the ability to print pages directly to PDF, and new event-driven code capabilities that allow for more efficient handling of events such as DOM mutations, JavaScript errors, and network interceptions.

Relative locators in Selenium 4 allow you to find elements based on their spatial relationships to other elements on the page. For example, you can find an element to the right of another element or directly above it, using the bounding box coordinates and DOM structure.

Selenium 4 has enhanced handling of window operations, allowing users to create new tabs and windows and switch between them more intuitively. This addresses previous limitations where Selenium could not fully control browser window management.

Yes, Selenium 4 introduces a new feature that allows the creation of PDF files from web pages using the page printing APIs. These APIs capture the rendered page and encode it in Base64, which can then be saved as a PDF file or used directly in memory.

Skeleton 4 introduces APIs that support event-driven automation, allowing tests to react to events such as DOM mutations, JavaScript errors, and console logs without continuous polling. This makes the testing process more efficient and less prone to errors.

Selenium Grid allows for scalable and parallel testing across different environments. In Selenium 4, it has been re-architected with modern technologies like event buses, improved scalability options such as Docker images, and integrated observability with tools like Jaeger.

While Selenium 4 introduces many new features and improvements, it has been designed to allow easy upgrading from previous versions. Users may encounter deprecation warnings as part of the upgrade process, but these are intended to guide rather than hinder the transition.

David Burns
David Burns
32 min
19 Nov, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Selenium 4.0 introduces exciting features such as relative locators, new window APIs, event-driven code, and network interception. It aims to make automation easier with improvements in scalability, observability, and handling of windows and tabs. The focus is on improving the quality of the web and incorporating user feedback. Selenium 4.0 also offers better support for mobile testing and cloud services, with ongoing documentation improvements.

1. Introduction to Selenium 4.0

Short description:

Hello, everyone. Today, I'll talk about Selenium 4.0 and its new features, including relative locators, new window APIs, and event-driven code. Stay tuned for the exciting features in Selenium Grid.

Hello, everyone. And welcome to my talk for today. I'm going to be talking about Selenium 4.0 which was only released a couple weeks ago. But before we get into that, I would like to kind of just tell you who I am.

My name is David. I head up the open source team at Browserstack. I'm a Selenium Core contributor, I'm a co-editor on the WebDriver specification within the W3C. And I am the chair of the browser testing and tools working group.

So, whenever things want to be standardized, they tend to come through my working group where we try our best to make sure that all the browsers are going to support you, the end user. And here is our agenda for today. So, I'm going to be talking about what is Selenium 4. Some of the new features that have gone into it, like relative locators and new window APIs, there's the new ability to print pages, and then I'm going to spend a little bit of time talking through the new event driven code, which allows you to instead of having to poll for how your test should work with Selenium, you can now get events emitted to you and carry on with your tests. These are really cool new features. And at the end, I'll just finish off on some of the really great new features within Selenium Grid.

2. Selenium 4.0 Overview

Short description:

Selenium 4 has been an amazing amount of work that took five years and over 4,400 commits from contributors around the world. The main change is that you'll be able to just drop it in and things should just work. There will be deprecation warnings, but they should not be scary. We're preparing for Selenium 4.1 and beyond.

So Selenium 4 has been an amazing amount of work that has gone into it. Think of it kind of like building a city. It took five years for us to get this out, and over 4,400 commits from numerous contributors around the world. We've rewritten large parts of the code base. We've deprecated large parts of the code base. And so whenever you start using it, it's going to be a big change, but the main change that you won't notice, really, is that you'll be able to just drop it in and things should just work. This is one of the key reasons spent so much time focusing on the little bits to make that easier. So, when you change, there will be a number of deprecation warnings that you have to work through, but none of them should be scary at all. It's all about kind of making sure that we're ready for whenever we go to Selenium 4.1 and beyond.

QnA