How do I select an item in the list of menu items once it appears as a dropdown? I tried sendKeys to input the text like "Brown Mustard", but it clears out when I hit the submit button. I know I should be able to type it in the field but WebDriver sendKeys didn't work, so if you have suggestions on how to select from a list menuitems, thanks so much!
Here's the html snippet of the text field and the menu items that appear when you enter say "B"
<input id="combobox0-text" class="ui-autocomplete-input ui-widget
ui-widget-content tableRightFormTextField" autocomplete="off"
role="textbox" aria-autocomplete="list" aria-haspopup="true">
<li class="ui-menu-item" role="menuitem"><a class="ui-corner-all"
tabindex="-1">Bro<strong>w</strong>n Mustard</a></li>
<li class="ui-menu-item" role="menuitem"><a class="ui-corner-all"
tabindex="-1">Bro<strong>w</strong>ntop</a></li>
After entering B, you could create a select object of the menu items and then select items based on visible text
This is how it shall work:
FYI: It shall select the first/top menu item after sending keys. So, type more keys if you wanted to select a particular item.
you can try using wait,
the above code will clear the
input field
andtype in the required item
and wait for the menu item to appear in the drop down...,the 3rd statement will click on themenu item
..