To simulate clicks within a flash object, you will probably have to use js-ctypes.
Find the element with javascript, get the elements screenX and screenY and then add the DOMWindow's screenX and screenY (the window maybe resized to smaller window and moved) and then call click with js-ctypes.
This is how to do it in windows:
Components.utils.import("resource://gre/modules/ctypes.jsm");
var lib = ctypes.open("user32.dll");
var struct_Point = new ctypes.StructType("Point", [
{"x": ctypes.int},
{"y": ctypes.int}
]);
var GetCursorPos = lib.declare('GetCursorPos',
ctypes.winapi_abi,
ctypes.bool,
struct_Point.ptr
);
/* Use it like this */
var point = new struct_Point;
var ret = GetCursorPos(point.address());
Components.utils.reportError(ret);
Components.utils.reportError(point);
This page has how to do it in mac os and linux:
https://developer.mozilla.org/en-US/docs/Mozilla/js-ctypes/Standard_OS_Libraries
/*start setcursorpos*/
var SetCursorPos = lib.declare('SetCursorPos', ctypes.winapi_abi, ctypes.bool, ctypes.int, ctypes.int)
function doSetCursorPos() {
var ret = SetCursorPos(10, 10);
}
/*end setcursorpos*/
/*start mouse_event*/
var mouse_event = lib.declare('mouse_event', ctypes.winapi_abi, ctypes.void_t, ctypes.uint32_t, ctypes.uint32_t, ctypes.uint32_t, ctypes.uint32_t, ctypes.uintptr_t);
var MOUSEEVENTF_LEFTDOWN = 2;
var MOUSEEVENTF_LEFTUP = 4;
function domouse_event() {
var ret = mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
var ret = mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}
/*end mouse_event*/
Then this is how to use it. I actually made this as an autoclicker on April 1st this year for stackoverflow. They had this flash game where you had o click like 70-120 times on a boulder to get unicorn points. I thought you could unlock topics that people locked of mine, but it turned out to be scam. But got some good ctypes out of it.
Use like this:
function clickXTimesWhereCursorIs(X, everyMs) {
var point = new struct_lpPoint;
var ret = GetCursorPos(point.address());
Cu.reportError(ret);
Cu.reportError(point);
var ret = SetCursorPos(point.x, point.y);
for (var i=0; i<X; i++) {
setTimeout(function() {
var ret = mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
var ret = mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
}, i*everyMs);
}
}
setTimeout(function() {
clickXTimesWhereCursorIs(90, 100);
}, 3000)