I am having trouble with selecting an option from a drop down list which is made visible by clicking on an input text box. I am using Selenium with c#. The functionality is as follows;
- open web page
- click on Destination text box
- this causes a destinations drop down list to be displayed
- select an option from this list
- the option is then written to the Destination text box
The HTML for this list is;
<div id='dvCountryList'>
<select class="country-list" id="DestinationPicker" multiple="multiple" name="DestinationPicker">
<option value="AU">Australia</option>
<option value="ID">Indonesia</option>
<option value="FJ">Fiji</option>
<option value="US">United States of America (includes Hawaii)</option>
<option value="CN">China</option>
<option value="XA">Worldwide</option>
<option value="TH">Thailand</option>
</select>
</div>
My test code is a follows;
IWebElement destination1 = driver.FindElement(By.ClassName("select2-search__field"));
destination1.Click();
IWebElement destination2 = driver.FindElement(By.ClassName("country-list"));
SelectElement country = new SelectElement(destination2);
country.SelectByValue("AU");
Running this test yields the following error;
OpenQA.Selenium.ElementNotVisibleException : element not visible: Element is not currently visible and may not be manipulated
I tried using a wait before finding the country-list class but that did not help. I am quite new to Selenium so would appreciate any help / feedback. Thanks.