HttpWatch Automation Reference - Version 11.x
In This Topic
    Automation Overview
    In This Topic

    HttpWatch captures its data using a browser add-on for Internet Explorer or Google Chrome and displays previously recorded log files in HttpWatch Studio.

    Although, HttpWatch can be manually controlled it is sometimes useful to control it programmatically when running automated tests or performing other repetitive tasks.  The automation interface allows programs to be written that perform actions of the HttpWatch plug-in and provide access to data in existing .HWL and .HAR files.

    There are over thirty classes in the automation interface, but four main classes are used to control HttpWatch.

    This help file describes the HttpWatch automation interface. For information about using HttpWatch please open the HttpWatch Help file in the HttpWatch program group or click on Help->Help Topics in HttpWatch.
     HttpWatch Automation Architecture

    This diagram below shows the relationship between the four main automation classes and the browser:

    Controller Class Log Class Entry Class Plugin Class Log Class Entry Class IE Class

    (Click on classes in this diagram for more information)

     Automation Classes

    The four main automation classes used by HttpWatch are described in this section.

    Controller Class

    The starting point for controlling HttpWatch is the Controller class. An automation client uses this to create a new instance of the HttpWatch plug-in or to open existing log files.

    The IE and Chrome properties return an object that can create or attach to the HttpWatch add-on in the browser.

    Plugin Class

    The interface to the HttpWatch add-on for Internet Explorer or the Chrome extension is provided by the Plugin class. It has methods that can be used to start and top the recording of HTTP traffic. Other methods and properties allow the user to manage the HttpWatch log files and configure automatic recording.

    The Plugin object's GotoURL method can be used to direct the browser to any specified URL.

    Other properties allow the automation client to determine whether a page has finished loading and whether the plug-in is currently recording requests.

    Recorded requests are reached through the Log property.

    Log Class

    The Plugin object's Log property accesses a Log object that contains the active log of HTTP requests and responses that have been recorded by HttpWatch.

    Methods and properties are provided that allow the recorded data to be examined, saved to a file or exported in different formats (e.g. XML, CSV or HTTP Archive .HAR)

    Alternatively, the OpenLog method of the Controller class opens a log file and returns a reference to a Log object that represents the requests and responses that were recorded in that file.

    Entry Class

    Each Log object contains a list of Entry objects which hold the details of a single HTTP transaction (i.e. request and response).

    The Content property holds information about the HTTP resource that was requested (an image or an HTML page, for example) and its Data property returns the actual content, e.g. the textual HTML of web pages and the binary data of image files.

    The Request and Response properties provide access to lists of the headers and cookies that were sent to or received from the web server.

    There also numerous other properties that provide further details of the transaction (e.g. the state of the browser cache before and after the transaction, the TCP/IP address and port number, the HTTP method used, the result or error information, timings, URL and so on).

     

    See Also