Monthly Archives: February 2020

Check if string is empty in java

Check if string is empty in java: We can check if string is empty, blank or null using below methods. 1 StringUtils 2. String.length() method 3. isEmpty() method   1. StringUtils: Apache string utility is giving isBlank() method. It is used as below.

  2. String.length(): When a string length is equals to ‘0’… Read More »

testng timeout test

TestNG timeOut: TestNG timeout method can be used in below real time scenarios. 1. When a loop goes infinite, test never ends. In this case we can set a predefined time limit using Timeout() method. 2. When a response is slow (slow page loading), it will take more time than usual. In this case we… Read More »

Selenium links2

Selenium WebElement actions Navigate commands How to upload file Select dropdown Waits in selenium Mouse-hover actions Handle alerts Common exceptions in selenium TestNG TestNG Annotations      

Get last 4 characters of string

Get last 4 characters of string: You may come across situations where we need to get last 4 characters of string in Java. Below are the ways to extract last 4 characters of string/integer. 1. First we need to check the string length. 2. If the string length is greater then 4 characters then we… Read More »