What are New Features in Selenium 4.0
1) WebDriver
became W3C(World Wide Web Consortium) standardization
The
standardizing the WebDriver as per the W3C standards. W3C standards encourage
compatibility across different software implementations of the WebDriver API
and make the Framework much more stable & reduce compatibility issues
across different Web Browsers.
A
test in Selenium 3 communicates with the browser at the end node through the
JSON wire protocol.
Testing
tools such as Appium and iOS Driver which are related to mobile testing heavily
rely on JSON wire protocol.
With Selenium 4 adapting W3C Protocol for
communication between the driver and browser, Tests will now be able to
directly communicate the browser without using API encoding/decoding. Which
would help in mobile testing users.
2) Improved
Selenium Grid
The
Selenium Grid code has been modified with many changes and needed improvements;
the console of the selenium grid has been restructured.
It
allows you to execute test cases in parallel on multiple browsers and systems
as well as operating systems. New Grid Server supporting
“standalone”, “hub”, “node”, and completely distributed usage. In Selenium 4, the process is much easier. The moment you start the Selenium Grid, it will act as both node and hub. There is also better Docker support and no chance of thread safety bugs.This new Grid
Server is able to output logs in single-line json format to the stdout.
3) Support
for browsers
Native
support for Opera and PhantomJS going forward will be removed. Whereas users
who want to test Opera can opt Chrome since Opera is based on Chromium and for
PhantomJS users can use Chrome or Firefox in headless mode. And Selenium Server
now no longer includes HtmlUnit by default.
4) New
Selenium 4 IDE (Chrome & Firefox)
Selenium
IDE is a Chrome and Firefox plugin which records and plays back user
interactions with the browser.
Use
this to either create simple scripts or assist in exploratory testing.
New plugin system – Any browser vendor
will now be able to easily plug in to the new Selenium IDE. You can have your
own locator strategy and plug in the Selenium IDE.
New CLI runner – It will be completely
based on node.js, not the old HTML-based runner. It will have the following
capabilities:
WebDriver
Playback – The new Selenium IDE runner will be completely based on
WebDriver.
Parallel execution — The new CLI runner will also support parallel
test case execution and will provide useful information like time taken and
number of test cases passed/failed.
5) WebElement.getSize() and WebElement.getLocation() are now replaced with a single method WebElement.getRect().
getSize(): get the width and Height
of the specific element on the webpage.
getLocation():get the exact
"x" and "y" coordinates of the element.
Now
in selenium 4 width and Height of the element and x and y coordinates of
element get from single method getRect().
6) Now you can configure the
location of your Safari driver using the “webdriver.safari.driver” system
property.
7) Element
screenshotting
Now we can take required UI WebElement
Screenshot , instead of full webpage.
8) driver.switchTo().parentFrame()
We can use it to go from the child
frame to the parent frame directly,instead of going to default frame.
Code Snippet for Parent Frame
Code Snippet for Parent Frame
9) The Options class for
every browser is now extending the Capabilities class.
10) Removed
the firefox.profile class. All its functionality is now provided directly by
firefox.options.
11) Operating Multiple Tabs
or Browsers.
Introduced a new method newWindow()
method for opening a new blank tab or window while the originally opened window
is still open and then load different
applications and perform operations in both the opened windows or tabs.
12) Relative Locators
In Selenium3 each element is
accessed separately as there is no way to access a web element relative to the
nearby elements, now Selenium 4
You can access the element using
Relative Locators using TagName.
It allow you to identify objects in
your application based on other objects that are always near them.
As of now it will support below options
Above: Web element to be
searched/located appears above the specified element.
Below:Web element to be
searched/located appears below the specified element.
toLeftOf:Web element to be
searched/located appears to the left of the specified element.
toRightOf:Web element to be
searched/located appears to the right of the specified element.
Near:Web element to be
searched/located is at most 50 pixels away from the specified element.
13) Support of ChromeDevTool
Getting Chrome Browser Console Logs.
Ignoring Certificate Errors.
And many other operations can be performed at the
Chrome Browser. Developer Tools level using Selenium Automation Scripts.
Code Snippet for DevTools
Code Snippet for DevTools
Comments
Post a Comment