On https://www.emirates.com/us/english/ site Departure Airport DropDown I am trying to select 3rd option Jakarta here by typing the keyword KAR but I am unable to do that. It types the keyword kar and then displays the suggested options but does not select 3rd option Jakarta. Please help. Attaching the picture of the dropdown and code i am running:

WebElement source=driver.findElement(By.xpath("//input[@name='Departure Airport']"));

for(int i=1;i<=3;i++)


enter image description here

  • First off, welcome to SQA, @Fahmed! Have you tried this approach: source.sendKeys("kar"); source.sendKeys(Keys.Enter) or, source.sendKeys(Keys.Tab)?
    – Brian
    Commented Apr 12, 2019 at 17:45
  • when i try manually, pressing the DOWN key does not work to select a item Commented Apr 16, 2019 at 8:54
  • Try Thread.sleep(3000); just before the loop. If it didn't work, get the list ( List<WebElement> ) to store and then find the element you want and click/enter
    – Syrus
    Commented Sep 10, 2019 at 6:14

1 Answer 1


The keys.DOWN is send to the element source not the browser.

According to the code of sendkeys:

  • Use this method to simulate typing into an element, which may set its value.

It might not even truly send the actual keys, but change the value of the element.

I would try the Actions to sendkeys to the browser instead.

(new Actions(driver)).sendKeys(Keys.DOWN).perform();

Alternatively just search the full location with the word "Jakarta + ENTER" instead of using a partial search on KAR, unless you are testing the dropdown itself. Since the dropdown is probably part of a framework I would let the dropdown testing to the framework builders so you can focus on the application behaviour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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