Test autocomplete with Selenium webdriver
I found a workaround about this. My problem was:
- Selenium inputted 'Mandaluyong' to an auto-suggest location field
- The auto-suggest field appears together with the matched option
- Then selenium left the auto-suggest drop-down open not selecting the matched option.
What I did was:
driver.findElement(By.name("fromLocation")).sendKeys("Mandaluyong");
driver.findElement(By.name("fromLocation")).sendKeys(Keys.TAB);
This is because on a manual test, when I try to press TAB key, two things were done by the system:
- Picks the matched option from the auto-suggest drop-down
- Closes the auto-suggest drop-down