I'm using jQuery Selectable to manage a calendar. This function works great, its just a matter of getting in to test automation.
I need to select multiple non-consecutive dates from the calendar grid.
I've tried a few things, not really expecting them to work
date = '2013-05-02'
page.execute_script %{
var e = jQuery.Event("keydown");
e.ctrlKey = true; // # Some key code value
e.keyCode = 17
$("body").trigger(e);
}
find("td[data-date='#{date}']").click
I do this for a series of dates but it seems to ctrl key isn't being considered because only the last date selected actually gets selected.
You can use selenium-webdriver's action builder. However, there seems to be a bug in the firefoxdriver that prevents this from working at the moment (possibly issue 4863).
Here is a working example of the JQuery Selectable page using Chrome: