The first-ever release of Selenium WebDriver 1.0 in 2007 has indented a lasting footprint in web automated testing. And through the years, the contributions of the Selenium project (WebDriver, Grid, and IDE) have truly transformed the way that we do quality assurance.
Fast forward to the ‘drop-in’ release of Selenium 4 and Selenium 4.1, this article narrows down the top 5 changes you need to know for WebDriver, IDE, and Grid.
W3C Standardization
Cross-browser testing has received an efficiency boost from the updates in Selenium’s architecture.
The WebDriver APIs have removed the support for the legacy protocol and are fully compliant with the W3C Standardization. Allowing browsers and test scripts to communicate straight to the targeted browsers, users no longer have to go through the JSON wire protocol to encode and decode API requests.
For those that still have the ChromeDriver and GeckoDriver browser drivers in use, this standardization will not cause any effects since they have already supported the W3C protocols.
To reassure you, using the W3C WebDriver will not cause any harm to existing users. The main changes only evolve around Capabilities and the Actions class.
Adding and deleting WebDriver APIs
FindsByID
, FindsByCss
or related FindsBy*
(findElementBy
) interfaces have been removed and replaced with ‘By’ instance. Before
driver.findElementByCssSelector(“.className”);
driver.findElementById(“elementId”);
driver.findElementByXPath(“xPath”);
After
driver.findElement(By.cssSelector(“.className”));
driver.findElement(By.id(“elementId”));
driver.findElement(By.xpath(“xPath”));
ElementClickInterceptedError
, InsecureCertificateError
, InvalidCoordinatesError
, and NoSuchCookieError
classes are included in /lib/error.Sample code snippet to open a new window
driver.get(“https://www.katalon.com/”);
// Opens a new window and switches to new window
driver.switchTo().newWindow(WindowType.WINDOW);
// Opens Katalon Academy homepage in the newly opened window
driver.navigate().to(“https://www.academy.katalon.com/”);
Sample code snippet to open a new tab within the same window
driver.get(“https://www.katalon.com/”);
// Opens a new tab in existing window
driver.switchTo().newWindow(WindowType.TAB);
// Opens Katalon Download page in the newly opened tab
driver.navigate().to(“https://www.katalon.com/download/”);
Network.emulateNetworkConditions
command helps compare the average loading time by scripting tests that emulate a range of network speed (slow and normal) and connection type (BLUETOOTH, 2G, 3G, 4G, WIFI, etc.).Selenium IDE
The following are the updates Selenium 4 has added to Selenium:
Taking pointers and learning from the success of the Zalenium and Selenoid projects, Selenium Grid most notable change is being able to:
The release of Selenium Grid 4.1 can be read in detail here.
Loving Selenium? Give Katalon Studio a Try Too!
As a legacy library, many test automation tools have used Selenium as a base to develop a complete framework that is ready to work with right away. For Katalon Studio, it’s no exception.
Built on top of Selenium and Appium, Katalon Studio is an all-in-one solution for web, mobile, API, and desktop (Windows) low-code test automation. What makes Studio different from open-source libraries is everything is baked-in into a single tool for users to only focus on testing. This means that teams no longer have a dedicated team to build and maintain their own test automation framework, or to have a strong foundation in programming to start testing.
Any activities relating to creating, executing, maintaining, or generating reports for your tests can be done right away without extra coding or configuration with 3rd-party tools.
Some of Studio’s highlights are: