Saturday, March 21, 2009

Automating Firefox with iMacros

Automating Firefox with iMacros
http://linux.com/feature/123844
By Chad Files on January 14, 2008 (9:00:00 AM)

Share Print Comments

Do you have some mundane task that you have to do regularly through a Web browser? Are you a developer who wants to automatically test the interface of your latest Web application? Maybe you want to log into all of the sites you visit on a daily basis with one click. If you fall into any of these categories, you should check out the iMacros Firefox extension.

The iMacros for Firefox is a record and playback automation tool for the browser. The extension uses the Firefox engine to track all actions and record them in scripts that can be saved, shared, and loaded for playback. It supports most JavaScript, which sets iMacros apart from most freely available Web automation tools. The free version of iMacros cannot record actions performed on Flash objects, Java applets, or any other third-party plugins, but a $500 business edition has support for various plugins, including Flash, Java, and Silverlight.

iOpus, the company that makes iMacros, also has a free Internet Explorer version of iMacros. Each version of iMacros can run the other's scripts, so you can create testing scripts once and test on both browsers.

Once installed, iMacros adds a new button in the main navigation bar. When you click the button, a sidebar opens to display a list of recorded macros, along with a few tabs and buttons to control the macros.

To record a macro, click on the Rec tab then the Record button, then go into the main browser window. Everything you do will be recorded by iMacros and made into a script. When you are ready to stop recording, click the stop button in the iMacros sidebar. iMacros saves the current macro script as #Current.iim in its list of macros. You can play the script by clicking the Play tab then the Play button. You can stop or pause playback at any point during execution by clicking the respective button.

You can store a macro you just created in one of two ways: Either click the Save button on the Rec tab, or right-click the #Current.iim macro and choose Rename from the menu.

iMacros also has several features to manage macros. One of the most useful is the ability to edit a macro script by hand. To do this, select a macro, click the Edit tab, then the Edit Macro button. This will open a small text editor with the macro script preloaded. This feature gives you the ability to fine-tune your macros. If you would rather use a different text editor to modify the script, you can tell iMacros what editor to use in the options dialog of the Edit tab. You can change several other settings as well using this dialog.

Another useful feature is the ability to play a macro in a loop. On the Play tab you can tell iMacros how many times you want to play the selected macro by providing a Max value then clicking the Play (Loop) button. This feature gives you the ability to load-test an application and a server. By sharing and simultaneously running a macro on several computers, you can get a real-world idea of just how much traffic your services can handle.

iMacros has become part of my everyday routine. It has saved me countless hours of testing and caught several overlooked bugs.

Every Monday we highlight a different extension, plugin, or add-on. Write an article of less than 1,000 words telling us about one that you use and how it makes your work easier, along with tips for getting the most out of it. If we publish it, we'll pay you $100. (Send us a query first to be sure we haven't already published a story on your chosen topic recently or have one in hand.)

Chad Files, a software developer and writer, has been developing software applications for more than 10 years, and is a contributing developer to many open source projects.

No comments:

Post a Comment