Simulate a click on fullcalendar event

For my current project I am using the excellent jQuery calendar plugin fullcalendar by Adam Shaw.

Whilst creating a functional test with phpunit and Selenium, I found that triggering a click on the calendar event was not reaching the procedure I defined for eventClick in fullcalendar. In fact, in order to get the click event to trigger, a mouseover event needs to be triggered on the same element. The correct way is:

$this->waitForElementPresent("css=span.fc-event-time");
$this->mouseOver("css=span.fc-event-time");
$this->click("css=span.fc-event-time");

1. Wait for the element to be present (important if using ajax events fetch).
2. Simulate mouseover.
3. Simulate click.

The “css=span.fc-event-time” locator will always point to the first event in the calendar, that’s ok for this example but if you need more specificity then I believe xpath is better.

Also, the above example also holds true for a js script. You always need to trigger a mouseover before a click!