[socal-piggies] TestGen4Web: Firefox extension for browser recording and playback

Grig Gheorghiu grig at gheorghiu.net
Fri Nov 11 13:07:17 PST 2005


TestGen4Web records browser actions as the user clicks through links on
a page, submits forms etc. It can the recorded actions as XML that can
then be munged via XSLT for example so that you get tool-specific
script files (for example for twill or Selenium).

Download it from
<http://developer.spikesource.com/wiki/index.php/Projects:TestGen4Web>.

Here's how a recorded file looks like (in this particular case I went
to Titus' Quixote demo site):

<?xml version="1.0" encoding="ascii"?>
<!-- Generated file. Please do not edit. Fri Nov 11 2005 13:02:42
GMT-0800 (Pacific Standard Time) -->
<tg4w version='0.35.3'>
    <actions>
    <!-- Step 0-->
        <action>
            <type><![CDATA[ goto ]]></type>
            <xpath><![CDATA[ window.location ]]></xpath>
            <value><![CDATA[
http://issola.caltech.edu/~t/qwsgi/qwsgi-demo.cgi/ ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 1-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ Quixote Demo ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 2-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ Quixote Demo ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 3-->
        <action>
            <type><![CDATA[ click ]]></type>
            <xpath><![CDATA[ */A[@CDATA="12\"] ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 4-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ The Number 12 ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 5-->
        <action>
            <type><![CDATA[ click ]]></type>
            <xpath><![CDATA[ */A[@CDATA="factorial"] ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 6-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 7-->
        <action>
            <type><![CDATA[ click ]]></type>
            <xpath><![CDATA[ */A[@CDATA="previous"] ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 8-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ The Number 11 ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 9-->
        <action>
            <type><![CDATA[ click ]]></type>
            <xpath><![CDATA[ */A[@CDATA="widgets"] ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 10-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ Quixote Widget Demo ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 11-->
        <action>
            <type><![CDATA[ select ]]></type>
            <xpath><![CDATA[ */FORM[1]/*/SELECT[@NAME="toppings"]
]]></xpath>
            <value><![CDATA[ green peppers ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 12-->
        <action>
            <type><![CDATA[ click ]]></type>
            <xpath><![CDATA[ */FORM[1]/INPUT[@TYPE="submit" and
@VALUE="Submit"] ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 13-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ Quixote Widget Demo ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    <!-- Step 14-->
        <action>
            <type><![CDATA[ click ]]></type>
            <xpath><![CDATA[ */A[@CDATA="dumpreq"] ]]></xpath>
            <value><![CDATA[  ]]></value>
            <page-refreshed><![CDATA[ true ]]></page-refreshed>
        </action>
    <!-- Step 15-->
        <action>
            <type><![CDATA[ verify-title ]]></type>
            <xpath><![CDATA[ * ]]></xpath>
            <value><![CDATA[ HTTPRequest Object ]]></value>
            <page-refreshed><![CDATA[ false ]]></page-refreshed>
        </action>
    </actions>
</tg4w>


Kind of ugly, but it might do the trick.

Grig




More information about the socal-piggies mailing list