feksを書いてテキストフィールドを埋めるwatirテストを作成しようとしています
「lon」とドロップダウンがトリガーされるまで待ってから、リストの最初の要素をクリックします。
「lon」と書くと、「London, England, Storbritannia」、London、Kentucky、USA などの多くのオプションがトリガーされます。事前にthnx。
これは私のコードが今までどのように見えるかですが、それはうまくいきません。
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('オスロ')
# 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
終わり