Latest Selenium Commands - Codoid
Select Page
Codoid Blog

Latest Selenium Commands

Irrespective of the business that your client is in, marketing is an integral part of their operations. In fact, in this day and age of social.

This blog article explains the latest Selenium Commands and methods which every automation tester must know. As an automation testing company, we keenly watch the enhancements in Selenium WebDriver to improve our test automation scripting for a robust solution. Let’s see the new Selenium commands one by one.

Latest Selenium Commands

WrapsElement

You can’t get the wrapped webelement from Select object once it is wrapped using Select class for Dropdown and List actions. However, in Selenium v3.141.59, you can get the wrapped element using getWrappedElement() method. Please see the below example.

Select select = new Select(dropDown);

select.getWrappedElement();  
  

Before and After GetText Methods

WebDriverEventListener class is used to view the events triggered by webdriver. Selenium version 3.13.0 has introduced two new methods (beforeGetText & afterGetText) in WebDriverEventListener class.

public class CustomListener implements WebDriverEventListener {

    public void beforeGetText(WebElement element, WebDriver driver) {

    }

    public void afterGetText(WebElement element, WebDriver driver, String text) {

    }
}
  

The above methods will be invoked before and after calling getText method for a webElement.

WebStorage

Web storage a provides a way for your web applications to store data locally within the user’s browser. There are two types of Webstorage (Local & Session). Local storage stores data with no expiration date. Session storage is similar to local storage, except that it stores data for one session only. You can get the local and session storage using the below snippet.

WebDriver driver = new ChromeDriver(chromeOptions);

((ChromeDriver) driver).getSessionStorage().size();
  

OkHttp

Now Selenium Grid communication between Hubs and Nodes is using OkHttp instead of the Apache HttpClient. OkHTTP is an open source project designed to be an efficient HTTP client. It supports the SPDY protocol. SPDY is the basis for HTTP 2.0 and allows multiple HTTP requests to be multiplexed over one socket connection.

Written By

Submit a Comment

Your email address will not be published. Required fields are marked *


This blog article explains the latest Selenium Commands and methods which every automation tester must know. As an automation testing company, we keenly watch the enhancements in Selenium WebDriver to improve our test automation scripting for a robust solution. Let’s see the new Selenium commands one by one.

Latest Selenium Commands

WrapsElement

You can’t get the wrapped webelement from Select object once it is wrapped using Select class for Dropdown and List actions. However, in Selenium v3.141.59, you can get the wrapped element using getWrappedElement() method. Please see the below example.

Select select = new Select(dropDown);

select.getWrappedElement();  
  

Before and After GetText Methods

WebDriverEventListener class is used to view the events triggered by webdriver. Selenium version 3.13.0 has introduced two new methods (beforeGetText & afterGetText) in WebDriverEventListener class.

public class CustomListener implements WebDriverEventListener {

    public void beforeGetText(WebElement element, WebDriver driver) {

    }

    public void afterGetText(WebElement element, WebDriver driver, String text) {

    }
}
  

The above methods will be invoked before and after calling getText method for a webElement.

WebStorage

Web storage a provides a way for your web applications to store data locally within the user’s browser. There are two types of Webstorage (Local & Session). Local storage stores data with no expiration date. Session storage is similar to local storage, except that it stores data for one session only. You can get the local and session storage using the below snippet.

WebDriver driver = new ChromeDriver(chromeOptions);

((ChromeDriver) driver).getSessionStorage().size();
  

OkHttp

Now Selenium Grid communication between Hubs and Nodes is using OkHttp instead of the Apache HttpClient. OkHTTP is an open source project designed to be an efficient HTTP client. It supports the SPDY protocol. SPDY is the basis for HTTP 2.0 and allows multiple HTTP requests to be multiplexed over one socket connection.