Whenever I try to run my tests, the autocomplete dropdown menu doesn't appear unless I physically click on the search input field.
This is a Cucumber test that utilizes Selenium Webdriver, and the data is sourced from the Crafty Clicks Address Autocomplete API.
I've experimented with various iterations of the same solution gathered from different posts and sources, all resembling something like this:
def fill_in_autocomplete(selector, value)
page.execute_script("
window.onload = function() {
$('#{selector}').focus().val('#{value}').keydown();
}
")
end
fill_in_autocomplete "#address_lookup", with: "EC2A 1AF"
I've also attempted more precise keydown-based solutions such as:
var e = jQuery.Event("keydown");
e.which = 50;
$("input").trigger(e);
Even after pausing the test and manually testing each solution in the console, none seem to work.
It's important to mention that I'm not utilizing jQuery UI, so any .autocomplete()
solutions are not applicable here.
Throughout the process, I've used sleep
at intervals to account for timing issues.
Unfortunately, I am at a loss for new ideas!