Mehmet Fatih

Mehmet Fatih

  • 858
  • 931
  • 39.5k

Reading the value of the selected dropdown element

Jan 15 2024 12:21 PM

I want to get the selected element from the dropdown list with Selenium, but it gets the first unselected value instead of the selected element. How can I fix this?

var val4 = drv.FindElement(By.Id("snf")).Text;


Answers (4)