Use the Select
class, which provides methods to select by visible text or value.
Java
Select select = new Select(driver.findElement(By.id("myID"))); select.deselectAll(); // If this is a multi-select select.selectByVisibleText("My Text"); select.selectByValue("myValue");
Python
select = Select(driver.find_element_by_id("myId")) select.deselect_all # If this is a multi-select select.select_by_visible_text("My Text") select.select_by_value("myValue")
C#
Select select = new Select(driver.FindElement(By.Id("myID"))); select.DeselectAll(); // If this is a multi-select select.SelectByVisibleText("My Text"); select.SelectByValue("myValue");