Firefox automation using Spider
As of Spider 0.0.2.4, Spider can load chrome urls which can be used to load the browser chrome as a page which can be scripted.
As a first test attempt at automating Firefox, I've tried to perform a series of actions such as opening menus, making selections from menus,
and loading pages using keyboard short cuts and user generated KeyEvents. The results are promising but have limitations
due to the fact that the user generated KeyEvents are not trusted and the need to keep track of the objects which currently
have focus. The userhook
script is a kludge, but illustrates the attempt.
To run the automation yourself, first install Spider 0.0.2.4, then either:
-
Paste this link into the URL bar, or
-
run Spider as a chrome application from the command line.
firefox -spider -url chrome://browser/content -hook http://bclary.com/projects/spider/automation/userhook.js -start -jserrors -jswarnings -chromeerrors -xblerrors
Some of the issues with this example are:
- The attempts to navigate to a new page using the keyboard fail. I think this is due to the untrusted nature of the user create KeyEvents.
- The Error Console is successfully opened when run in the browser if you grant permission to spider to open popup windows (?!) but fails to open when run as a chrome application.
- The script needs to do a better job of tracking the XUL element with the focus so that the key events can be properly dispatched. Note that actions which open OS native widgets (such as file pickers) or that open other applications (such an Email application), are not controllable using this technique.