How do I select a "li" element from a "ul" tag list?
This is my current code
vtenants.VT_USDelselectfld.Click(); //Clicks field to display the dropdown
Thread.Sleep(500);
IList<IWebElement> dropDownMenu = driver.FindElements(By.CssSelector("#typeahead-1358-1464")); //Populates all drop down menues
IList<IWebElement> selectdelegation = dropDownMenu[1].FindElements(By.TagName("li")); //Here is where i receive the error
selectdelegation[1].Click(); //Here i "should" select the dropdown Item
I receive the error " Index was out of range. Must be non-negative and less than the size of the collection."
HTML Example
<ul class="dropdown-menu ng-isolate-scope" ng-show="isOpen()
<li class="uib-typeahead-match ng-scope" ng-repeat="match in matches
track by $index" ng-class="{active: isActive($index) }" etc…
</li>
</ul>
[1]
looks suspicious for a selector based on an ID, because there should only ever be one element with a given ID. – jonrsharpe Aug 1 '19 at 10:05