Hello Dinesh, this error usually occurs when browser isn't able to find the element on the webpage due to incomplete loading of the webpage. To resolve the issue, you can use Thread.sleep(time_in_miliseconds) to sleep/pause the execution, so that the page can be loaded completely before findElement method starts finding the required element. Take a look at the following code to understand better:
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class TestClass {
public static void main(String s[]) throws InterruptedException {
System.setProperty("webdriver.chrome.driver", "D:/chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://google.com");
driver.findElement(By.name("q")).sendKeys("Selenium");
Thread.sleep(5000);
driver.findElement(By.xpath("//div[@class='sbsb_a']//ul/li[4]")).click();
}
}