Auto -complete text in selenium

How to fill autocomplete text in selenium-Python Platform.
I need to enter the city information in the textbox.I tried using key.ARROW_DOWN, Keys.RETURN but it didn't workout. This textbox accepts the information only after clicking on the value from the drop-down list else it don't accept it.  I am not sure how to select option from the drop-down list.
Kindly help on this issue.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import Select
import time 
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


driver = webdriver.Chrome('C:\\Users\\Vivekanandhan\\Downloads\\Compressed\\chromedriver_win32\\chromedriver.exe')


driver.get('http://poorvapunya.com/marriage_match_horoscope.php')
girl_name = driver.find_element_by_name("girl_name")
girl_name.send_keys('girl_name')
birth_date_fm= driver.find_element_by_name("birth_date_fm")
birth_date_fm.send_keys('20.9.2017')

select = Select(driver.find_element_by_name('birth_hours_fm'))
select.select_by_value('1')

select = Select(driver.find_element_by_name('birth_minutes_fm'))
select.select_by_value('49')

select = Select(driver.find_element_by_name('birth_ampm_fm'))
select.select_by_value('0')

birth_city_fm = driver.find_element_by_id("birth_city_fm")
birth_city_fm.click()
birth_city_fm.clear()
#birth_city_fm.send_keys('India', Keys.ARROW_DOWN)
WebDriverWait(driver, 10).until(EC.visibility_of_element_located((By.XPATH,'//input[@placeholder="Enter your place of birth and select from list"]'))).send_keys("India")


              
#########################################

boy_name = driver.find_element_by_name("boy_name")
boy_name.send_keys('boy_name')
birth_date_fm= driver.find_element_by_name("birth_date_m")
birth_date_fm.send_keys('20.9.2017')

select = Select(driver.find_element_by_name('birth_hours_m'))
select.select_by_value('1')

select = Select(driver.find_element_by_name('birth_minutes_m'))
select.select_by_value('49')

select = Select(driver.find_element_by_name('birth_ampm_m'))
select.select_by_value('0')

birth_city_m = driver.find_element_by_id("birth_city_m")
birth_city_m.send_keys('India')

driver.find_element_by_xpath(".//*[@type='submit']").click()

Open in new window

SQL GuruAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Flabio GatesCommented:
perhaps:
birth_city_fm.send_keys('Chennai')
time.sleep(3.0)
birth_city_fm.send_keys(Keys.ARROW_DOWN)
birth_city_fm.send_keys(Keys.TAB)

Open in new window

and then later on
birth_city_m.send_keys('Chennai')
time.sleep(3.0)
birth_city_m.send_keys(Keys.ARROW_DOWN)
birth_city_m.send_keys(Keys.TAB)

driver.find_element_by_xpath(".//*[@type='submit']").click()

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Selenium

From novice to tech pro — start learning today.