Simulating a click on a page element:
click = document.createEvent("UIEvents");
click.initUIEvent("click", true, true, window, 1);
worked = theElement.dispatchEvent(click);
So we create an event of type UIEvents, initialise it as a (cancellable, bubbleable) click event, and send it to /theElement/ of our choice.
This method seems clearer than simulating mouse clicks, or focussing the element and simulating a spacebar press. Btw /worked/ is often false when the event was successfully despatched, I suspect I don't quite understand dispatchEvent yet.
(This is just a recipe from reading the Moz createEvent page)
Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.
Quick
- ($a, $b....) = unpack("A2A7...", $packed)
- push( array, list )