Wednesday, December 10, 2008

How To Automate Web Applications And Web Sites Quickly And Easily By Recording Web Browser Activity

Writen by Marcus Tettmar

We've all heard the latest buzz word, Web 2.0. Whatever you think of this new moniker the fact is that most of us are using web sites and web applications every day and their use is growing. Many applications that once belonged to the desktop are now running on the web – email, banking, calendars and scheduling applications are common place. We now even have web based word processors, such as Google Write. Many business applications are also moving to the web, and businesses are realising the benefits of subscription based services and centralised support and are running their sales order processing, invoicing and payroll systems on web technology. Many companies are using web technology in-house to support their enterprise, and users are now using applications running within their web browser, rather than traditional desktop applications.

Traditional scripting languages, batch tools and automation solutions are inadequate for automating these new web based applications. Macro recorders and automation solutions which automate desktop applications by simulating user activity are incapable of driving web browser based functionality primarily because web sites and web applications are dynamic. Not only do they change frequently due to a single centralised source, but objects don't necessarily always appear in the same relative position on the page. Web pages can be resized, moved and scrolled up and down. A new approach to scripting web sites and web applications is required.

Fortunately Microsoft's Internet Explorer web browser provides a scripting interface and a Document Object Model (DOM). The Document Object Model exposes all the tags and attributes of all the elements beneath the page. Via the scripting interface the properties and methods of these elements can be modified. So, for example, links can be "clicked" and form elements can be filled in and submitted. So scripts and programs can be written to automate Internet Explorer and drive web applications.

However, you need to be a good programmer to understand how this all works. Not only do you need to understand the Document Object Model, but to write a routine that uses it you need to understand HTML. To determine names of elements and form fields etc., the HTML source of the page needs to be pulled apart, dissected and analysed. You need to understand programming technologies in order to build the routine. Even developing such an automation script in VBScript isn't for the faint hearted.

What is needed is a tool that records what you do in Internet Explorer, analysing the objects you click on and fields you complete as you go. WebRecorder, from MJT Net, is one such tool. WebRecorder is like a tabbed browser. As you navigate through pages, click on links, select radio boxes and drop downs and complete form fields it identifies the objects and builds a script as you go, using simple to understand code.

For programmers, WebRecorder reduces effort and speeds up development. For less technical users, WebRecorder records web activity which can be played back accurately later.

WebRecorder creates straightforward code that anyone can understand, and can be used with Macro Scheduler, a well known Windows automation tool.

Another web recording tool, is WebAction from Copasetic Software LLC. This works slightly differently in that it installs itself within Internet Explorer as a Browser Helper Object. WebAction records activity in Internet Explorer and creates internet macros which you can play back. However, macros cannot be edited and will not run in other scripting environments, so this tool is focused more for basic macros and is less flexible.

Web macro recorders and scripting tools are ideal for automating routine tasks in modern web sites and web based applications, or for automatically transferring data into or out of web applications and interfacing them with traditional solutions. These tools can also be used for automated testing of web sites and web applications and offer easier, speedier development over traditional scripting languages.

Marcus Tettmar is founder and CEO of MJT Net Ltd, specialists in windows automation and publishers of Macro Scheduler, the leading automation tool for Microsoft Windows; and WebRecorder for Web Application Automation. Find out more at http://www.mjtnet.com

No comments: