I am trying to select a specific option in a drop down menu. My current code highlights the selection I want, but moves on and does not keep the value in the field after "selecting" it. I want to grab the value "Medical." Currently I am using:
IWebElement element = driver.FindElement(By.Name("DISPLAY_CoverageType"));
SelectElement selector = new SelectElement(element);
selector.SelectByText("Medical");
The List I am pulling from looks like:
<option value="">Please Select One</option>
<option value="Medical">Medical</option>
<option value="Hospital">Hospital</option>
<option value="Dental">Dental</option>
<option value="Vision">Vision</option>
This highlights my selection in blue, but does not keep it selected when the drop down menu closes. Any advice?
Apparently going the repetitive and "easy" route was the correct way the entire time. This code helped me pass my tests:
Thanks to @alecxe for the idea of repeating calls.