Select a value from drop down using Selenium WebDriver C# [duplicate]

The code problem you are looking for is “Select a value from drop down using Selenium WebDriver C# [duplicate]”, we have come up with a better solution from many answers. That solution is mentioned below. If this c# programming code does not solve the problem, please contact us.

To select an Option from Drop Down use the below code

  1. To select a value based on Text

    new SelectElement(driver.FindElement(By.XPath(""))).SelectByText("");
    
  2. To select a value based on Value

    new SelectElement(driver.FindElement(By.XPath(""))).SelectByValue("");
    
  3. To select a value based on Index

    new SelectElement(driver.FindElement(By.XPath(""))).SelectByIndex(0);
    

Read more here: Source link