[Webtest] Doubt with the working of clickLink step and image tag

Prashant Mulgundmath webtest@lists.canoo.com
Thu, 12 Jan 2006 20:32:43 +0530


Hi,

I have been using Webtest for a month now. Yeah! I am a newbie :)  First 
of all, I would like to thank everybody who has been involved in the 
development of such an excellent product.

I have a doubt with the working of clickLink step. I am using clickLink 
to click on a link that does not have a label. However there is an image 
tag with alt attribute that contains the text I am giving in clickLink 
label. Problem is webtest is not able to find the link. From what I have 
read in webtest documentation and in the mailing list archives, label 
can contain text from alt attribute of image tag. Could somebody point 
out what I am doing wrong. Any help will be greatly appreciated.


This is the clickLink syntax that I have written:
-------------------------------------------------
<clickLink description="Click on the localhost" label="host" />


Following is the link from the frame source; I have reduced the href 
value because it was too long:
---------------------------------------------------------------------------------------------------
<td nowrap="nowrap"><a 
href="../hosts/SCMHostTree?SCMHostTree.Tree.NodeHref=7&amp;jato.pageSession=AKztAAVzcgA$$" 
name="SCMHostTree.Tree.NodeHref" class="TreLnk" title="host" 
onmouseover="window.status='host'; return true;" 
onmouseout="window.status=''; return true;" onblur="window.status=''; 
return true;"><img name="SCMHostTree.Tree.ChildImage" 
src="/containers/images/host16_unbadged.gif" alt="host" title="host" 
border="0" height="19" width="19" class="TreImg" /></a></td>


Following is the debug output of webtest:
-----------------------------------------
<snip>
  [webtest] (engine.Context                      331 ) Changed last 
response to https://localhost:6789/containers/hosts/SCMHostTree?selection=0
  [webtest] (steps.Step                          282 ) Start Step: 
clickLink "Click on the localhost link" (11/16)
  [webtest] (request.AbstractTargetAction        99  ) -> gotoTarget by 
clickLink
  [webtest] (steps.Step                          506 ) Exception thrown 
from this class: com.canoo.webtest.engine.StepFailedException
  [webtest] (steps.Step                          508 ) Message was: Link 
not found in page 
https://localhost:6789/containers/hosts/SCMHostTree?selection=0: label 
<host>, htmlId <null>, href <null>
  [webtest] Known Links in Page are:

  [webtest] (steps.Step                          506 ) Exception thrown 
from this class: com.canoo.webtest.engine.StepFailedException
  [webtest] (steps.Step                          508 ) Message was: Link 
not found in page 
https://localhost:6789/containers/hosts/SCMHostTree?selection=0: label 
<host>, htmlId <null>, href <null>
  [webtest] Known Links in Page are:


BUILD FAILED
Test step clickLink 
(webtest-scripts/SCMWebConsole/modules/ClickTestHost.xml:24: )  named 
"Click on the localhost link" failed with message "Link not found in 
page https://localhost:6789/containers/hosts/SCMHostTree?selection=0: 
label <host>, htmlId <null>, href <null>
Known Links in Page are:
"

Total time: 20 seconds

</snip>


Thanks in Advance
Prashant