Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to test a page that has an input but really its a drop down list. The user enters text and then a dropdown appears based on what the user inputted. They are groups that are in the database. If I look for these elements before typing anything they dont exist but once I start typing they do exist. The problem is I cant just type the whole name and then press enter or return because an option has to be selected from the list. I can press arrow down to get the focus on the item from the list but then if I say enter it doesnt select, it sends that enter to the original element and nothing gets selected. I can find the select element:

var ddList = driver.FindElement(By.CssSelector(".ui-autocomplete-input"));

This is the first time the list appears in the html. It looks like this:

<li class="ui-menu-item" role="presentation">
share|improve this question
<li class="ui-menu-item" role="presentation"> Can't see this without editing the comment for some reason – Darian Everett Apr 2 '14 at 21:07
Did you tried with Ajax control to click on the element ? – raj May 24 at 16:45
up vote 1 down vote accepted

Why don't you just type into the element like you said, and then find the elements? You can just make an array of them, but I assume from what you said that if you type the whole name then just one will appear, so that should be easy enough.

//your code

Thread.Sleep(500); //may have to adjust this based on how long it takes to generate; you can also sleep the driver itself if you want

var elements = driver.FindElements(By.CssSelector(".ui-menu-item")).ToArray();
var visible = elements.Where(r => r.Displayed).ToArray();
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.