anirbans
anirbans

Reputation: 19

how to select an option from an autocomplete field in selenium ide

i am testing a form of post a feed. where user can notify some existing user. while i am enter any data or character in the field its id is changes.

eg. if at the initial stage verifyValue id=token-input-auto_complete enter a data in the field ani verifyValue id=token-input-auto_complete ani

after enter the data in the field it shows only the character in the field but not shows any dropdown options

Upvotes: 1

Views: 10923

Answers (1)

JK.
JK.

Reputation: 21574

Do you mean a jQuery autocomplete? Or some other type of autocomplete (please name it if so)

This is how I select a jQuery autocomplete list value in selenium: (note this is typed in code, not recorded code). It is a bit tricky, you have to make it trigger the autocomplete, then you have to highlight the value, then you have to select it.

string locator = "id=token-input-auto_complete";
string value = "CATS";
selenium.Focus(locator);
selenium.Type(locator, value);
selenium.KeyDown(locator, "\\40");
Thread.Sleep(50);
selenium.KeyDown(locator, "\\40");
Thread.Sleep(50);
selenium.KeyDown(locator, "\\13");
Thread.Sleep(50);

Upvotes: 0

Related Questions