So follow this steps for solution:
First click on this driver. findElement(By. xpath("//input[@id='exampleInput']")). click();
Then select/click your li element same as above example. driver. findElement(By. xpath("li xpath")). click();
You can get more clarity on using the <Select> class, just look at the below Java code. WebElement dropdown = driver. findElement(By.id("Browsers")); Select select = new Select(dropdown); // Alternatively, you can shorten the same code as given below. Select select = new Select(driver.