I made a small plugin for jQuery to get the color of an image pixel. It's called broilerjs. I wanted to test the plugin via QUnit, a JavaScript Unit Testing framework. But I could not find a possibility to simulate a mouse click on special x and y coordinates. But in the end it was very easy.
function simulateMouseClick(x, y) {
var event = $.Event("click");
event.clientX = x;
event.clientY = y;
$(document.elementFromPoint(x, y)).trigger(event);
}