How to check which option in the dropdown is selected?

How to check which option in the dropdown is selected?

Hello Tim-Khorev,

Using is Selected() method, we can check the state of a dropdown’s option.

Select countriesDropDown

= new Select(driver.findElement(By.id("countries")));
dropdown.selectByVisibleText("India");
//returns true or false value 
System.out.println(driver.findElement(By.id("India")).isSelected());