[Dev] TG4W Interpreter.
William Martinez Pomares
wmartinez at AVANTICATEC.NET
Fri Apr 20 16:39:21 PDT 2007
Hi.
We've been working with TestGen4Web, which captures the navigation
strokes in Firefox and is able to reproduce them.
The idea was to capture those strokes for a transaction and then make
them into an scenario, to be run in TM5. We where to use HTMLUnit, but
it had some problems, and then we tried to create a new parser using
HTTP Client. The idea was either create an interpreter in java using
http client, or create a jython script that using the HTTP protocol in
TOOL would reproduce the steps.
Then we studied the XML generated by TG4W, and found this:
<tg4w version="0.40.0">
<actions>
<action type="goto" refresh="true" step="0">
<xpath><![CDATA[window.location.href]]></xpath>
<value><![CDATA[http://www.google.co.cr/]]></value>
</action>
<action type="verify-title" step="1">
<xpath><![CDATA[*]]></xpath>
<value><![CDATA[Google]]></value>
</action>
<action type="fill" step="2">
<xpath><![CDATA[*/FORM[@NAME="f"]/*/INPUT[@NAME="q"]]]></xpath>
<value><![CDATA[costa rica]]></value>
</action>
<action type="click" refresh="true" step="3">
<xpath><![CDATA[*/FORM[@NAME="f"]/*/INPUT[@NAME="btnG"and
@VALUE="Buscar con Google"]]]></xpath>
<value><![CDATA[btnG]]></value>
</action>
<action type="verify-title" step="4">
<xpath><![CDATA[*]]></xpath>
<value><![CDATA[costa rica - Buscar con Google]]></value>
</action>
</actions>
</tg4w>
Note the actions. They have an Xpath expression, a type of action and
some value. In this example we start with the google page (one action to
goto google, and the other one to check the title and validate the
paeg). Then we wrote "costa rica" in the search box and hit the click
button. Note that the click is represented by a click action, and the
xPath performs a search in the originally returned HTML.
If you are in firefox environment (that is, firefox is running) it would
have the page already loaded. That click action will tell firefox to
simulate a click and the gecko will perform the post using the form data
and such. That cannot be done using a simple http client (we would need
to parse the obtained HTML, to obtain the form, the post action url,
elements, etc).
Any ideas of which "html client" or engine could we use to process that
script?
William.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3189 bytes
Desc: not available
Url : http://cake.pushtotest.com/pipermail/dev/attachments/20070420/47caf527/attachment.bin
More information about the Dev
mailing list