i'm trying to create watir test that fills inn a textfield by writing feks
"lon" and waiting till the dropdown is triggered and then clicking on the first element in the list.
Writing "lon" should trigger many options like "London, England, Storbritannia", London, Kentucky, USA and etc. Is it somehow possible to this with watir?? thnx in advance.
This is what my code looks like until now, it odes not work though and i'm wondering where i have missed something.
def test_scriptflight_autocomplete @site.navigate_to(:travel, :flight) from_field = @site.ie.text_field(:id, "locOriginName") to_field = @site.ie.text_field(:id, 'locDestinationName') from_field.set('oslo')
# need to fire a key press event after setting the text since the js is handling
# trigger the autocomplete (requires a 'keydown')
from_field.fire_event('onkeydown')
# wait until the autocomplete gets populated with the AJAX call
@site.ie.wait_until{@site.ie.div(:id, 'onlinesearch').lis.length > 0}
puts @site.ie.div(:id, 'locOriginName ').lis.length
puts @site.ie.div(:id, 'locOriginName').li(:index, 5).text
# find the li you want to select in the autocomplete list and click it
@site.ie.div(:id, 'from-field').li(:text, 'Oslo, Oslo, Norge').click
end