How to select a value in an autocompleted textbox (API)

We had a discussion on another forum question about em dash, en dash, hyphen and other dash characters looking similar but the computer sees them differently. So, how about copying the HTML of the class (double click on “ui-menu-item”, right click and select copy) and then paste this phrase (replace) in place of the contents that I typed. This just ensures we have the correct characters in the statement so our phrase matches the HTML.

Another idea is to merge the two:

List<WebElement> menuItems = driver.findElements(By.xpath('id("ui-id-2")/li'))
WebUI.comment("We have " + menuItems.size().toString() + " items.")