Ruby script for automated testing of google autocomplete in HTML form using cucumber and capybara.
Add the following script for google autocomplete.


google_autocomplete.feature

Scenario: S1
    And I fill google autocomplete

google_autocomplete.rb

module name
  def fill_google_autocomplete(id)
    sleep 1
    ele=find(id)
    if ele
      ele.set "delhi"
      sleep 1
      ele.native.send_keys(:arrow_down)
      ele.native.send_keys(:return)
    end
    sleep 1
  end
end

World(name)

Then /^I fill google autocomplete$/ do
    fill_google_autocomplete("#location-div")
end