Selenium Interview : What is the difference between findElement and findElements?

What is the difference between findElement and findElements?

Answer: Both methods are abstract method of WebDriver interface and used to find the WebElement in a web page.

findElement() – it is used to find the one web element. It return only one WebElement type.

findElements()– it is used to find more than one web element. It return List of WebElements.

The sample code is as follows:

WebDriver driver = new InternetExplorerDriver();
driver.findElement(By.xpath(“——”));
List we=driver.findElements(By.xpath(“——”));