[Webtest] SetInputField issues? [was: How to decipher error output?]

Scott Glaser Scott Glaser" <sglaser@yahoo-inc.com
Thu, 19 Jul 2007 08:54:33 -0700


This is a multi-part message in MIME format.

------=_NextPart_000_0097_01C7C9E2.6D5E0AA0
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

You were right. I disabled javascript to get around this issue: <option
name="JavaScriptEnabled" value="false" />
 
Now I've run into another problem I can't solve. It seems it's not able to
find the HTML input field in the form. I don't understand why? I've also
tried using "htmlId=uname"
 
Scott
 
Snippet from webtest script:
 
        <setInputField description="set user name"
          formName="loginForm"
          name="u"
          value="alerttest" />
 
HTML form:
 
<div class="loginBox">
 
<form action="servlet/login" method="post" id="loginForm" name="loginForm"
onsubmit="checkJS()">
  <div class="field" style="padding-top: 10px;">
    <label for="uname">Username</label><input type="text" name="u" size="20"
maxlength="10" id="uname"/>
  </div>
 
  <div class="field">
    <label for="pwd">Password</label><input type="password" name="p"
value="" size="20" maxlength="32" id="pwd"/>
  </div>
 
  <div class="loginBtn">
    <div>
      <input id="loginButton" type="image" src="images/login-btn.gif"/>
    </div>
 
    <div style="margin: 8px 0 0 10px;"><ahref="signin/forgotPassword.do"
tabIndex="4">Forgot your password</a></div>
  </div>
 
  <input type="hidden" name="l" value="
<https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/processSignin
.do?JS_ENABLED=false>
https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/processSignin.
do?JS_ENABLED=false">
  <input type="hidden" name="lf" value="
<https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/loadSignin.do
?JS_ENABLED=false>
https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/loadSignin.do?
JS_ENABLED=false">
  <input type="hidden" name="JS_ENABLED" value="false" />
</form>
 
</div>

Output from script:
 
main:
 
BUILD FAILED
/home/sglaser/src/webtest/SimpleTest.xml:7: Canoo Webtest: R_1393.
Test failed.
Test step setInputField (/home/sglaser/src/webtest/SimpleTest.xml:25: )
named "set user name" failed with message "No suitable form found having
field named "u""

  _____  

From: John and Pip [mailto:pipandjohn@gmail.com] 
Sent: Wednesday, July 18, 2007 1:06 PM
To: webtest@gate2.canoo.com; Scott Glaser
Cc: webtest@gate2.canoo.com
Subject: Re: [Webtest] How to decipher error output?


Hi Scott,

The first thing to do is check whether there is actually a javascript error
in your web site, which is what the message below means. e.g. in Firefox go
to Tools/Error Console

regards,
        John 


On 7/19/07, Scott Glaser <sglaser@yahoo-inc.com> wrote: 


While running the following webtest script I get the below error. Any ideas
why I'm getting the assertion failure for the invoke step indicated? Since
I'm new to webtest I don't know how to generate more informative output to
debug the problem.
 

Scott
 
<project name="SimpleTest" basedir="." default="main">
 
  <property name="webtest.home" location="/home/sglaser/util/webtest-2.1" />
  <import file="${webtest.home}/lib/taskdef.xml"/>
 
  <target name="main">
    <webtest name="myTest">
      <config
        protocol="https"
        host="login11.marketingsolutions.yahoo.com"
        port="443"
        basepath="adui" />
      <steps>
        <invoke
          description="get login page"
          url="signin/loadSignin.do" />
        <verifyTitle
          description="verify title"
          text="New Sponsored Search Login" />
      </steps>
    </webtest>
  </target>
</project>
 
main:
   [invoke] java.lang.IllegalStateException: FAILED ASSERTION
   [invoke]     at org.mozilla.javascript.Kit.codeBug(Kit.java:477)
   [invoke]     at
org.mozilla.javascript.Interpreter.increaseICodeCapasity(Interpreter.java:17
07)
   [invoke]     at
org.mozilla.javascript.Interpreter.recordJump(Interpreter.java:1529)
   [invoke]     at
org.mozilla.javascript.Interpreter.addGoto(Interpreter.java:1459)
   [invoke]     at
org.mozilla.javascript.Interpreter.visitStatement(Interpreter.java:722)
   ...

BUILD FAILED
/home/sglaser/util/webtest-2.1/doc/samples/SimpleTest.xml:7: Canoo Webtest:
R_1393.
Test failed.
Test step invoke
(/home/sglaser/util/webtest-2.1/doc/samples/SimpleTest.xml:16: )  named "get
login   page" failed with message "Step[invoke "get login page" (1/2)]:
Script error loading page executing   webtest at: invoke FAILED ASSERTION



------=_NextPart_000_0097_01C7C9E2.6D5E0AA0
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2900.3132" name=3DGENERATOR></HEAD>
<BODY>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007>You were right. I disabled javascript to get =
around=20
this issue: &lt;option name=3D"JavaScriptEnabled" value=3D"false"=20
/&gt;</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007>Now I've run into another problem I can't =
solve. It=20
seems it's not able to find the HTML input field in the form. I don't =
understand=20
why? I've also tried using "htmlId=3Duname"</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007>Scott</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007>Snippet from webtest =
script:</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007></SPAN></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2><SPAN=20
class=3D492064415-19072007>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;setInputField description=3D"set user=20
name"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
formName=3D"loginForm"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
name=3D"u"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
value=3D"alerttest" /&gt;</SPAN></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D492064415-19072007></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D492064415-19072007>HTML=20
form:</SPAN></FONT></DIV>
<DIV><FONT><SPAN class=3D492064415-19072007>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>&lt;div=20
class=3D"loginBox"&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>&lt;form=20
action=3D"servlet/login" method=3D"post" id=3D"loginForm" =
name=3D"loginForm"=20
onsubmit=3D"checkJS()"&gt;<BR>&nbsp; &lt;div class=3D"field" =
style=3D"padding-top:=20
10px;"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;label=20
for=3D"uname"&gt;Username&lt;/label&gt;&lt;input type=3D"text" =
name=3D"u" size=3D"20"=20
maxlength=3D"10" id=3D"uname"/&gt;<BR>&nbsp; &lt;/div&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>&nbsp; &lt;div=20
class=3D"field"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;label=20
for=3D"pwd"&gt;Password&lt;/label&gt;&lt;input type=3D"password" =
name=3D"p" value=3D""=20
size=3D"20" maxlength=3D"32" id=3D"pwd"/&gt;<BR>&nbsp; =
&lt;/div&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>&nbsp; &lt;div=20
class=3D"loginBtn"&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&lt;div&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;input =
id=3D"loginButton"=20
type=3D"image" src=3D"images/login-btn.gif"/&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&lt;/div&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>&nbsp;&nbsp;&nbsp;=20
&lt;div style=3D"margin: 8px 0 0 =
10px;"&gt;&lt;ahref=3D"signin/forgotPassword.do"=20
tabIndex=3D"4"&gt;Forgot your password&lt;/a&gt;&lt;/div&gt;<BR>&nbsp;=20
&lt;/div&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff =
size=3D2>&nbsp; &lt;input=20
type=3D"hidden" name=3D"l" value=3D"</FONT><A=20
href=3D"https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/pro=
cessSignin.do?JS_ENABLED=3Dfalse"><FONT=20
face=3DArial=20
size=3D2>https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/pr=
ocessSignin.do?JS_ENABLED=3Dfalse</FONT></A><FONT=20
face=3DArial color=3D#0000ff size=3D2>"&gt;<BR>&nbsp; &lt;input =
type=3D"hidden"=20
name=3D"lf" value=3D"</FONT><A=20
href=3D"https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/loa=
dSignin.do?JS_ENABLED=3Dfalse"><FONT=20
face=3DArial=20
size=3D2>https://qalogin1.marketingsolutions.yahoo.com:443/adui/signin/lo=
adSignin.do?JS_ENABLED=3Dfalse</FONT></A><FONT=20
face=3DArial color=3D#0000ff size=3D2>"&gt;<BR>&nbsp; &lt;input =
type=3D"hidden"=20
name=3D"JS_ENABLED" value=3D"false" /&gt;<BR>&lt;/form&gt;</FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV dir=3Dltr align=3Dleft><FONT face=3DArial color=3D#0000ff=20
size=3D2>&lt;/div&gt;<BR></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D492064415-19072007><FONT =
face=3DArial=20
color=3D#0000ff size=3D2>Output from =
script:</FONT></SPAN></DIV></SPAN></FONT>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D492064415-19072007></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN=20
class=3D492064415-19072007>main:</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2><SPAN =
class=3D492064415-19072007>BUILD=20
FAILED<BR>/home/sglaser/src/webtest/SimpleTest.xml:7: Canoo Webtest:=20
R_1393.<BR>Test failed.<BR>Test step setInputField=20
(/home/sglaser/src/webtest/SimpleTest.xml:25: )&nbsp; named "set user =
name"=20
failed with message "No suitable form found having field named=20
"u""</SPAN></FONT></DIV>
<DIV dir=3Dltr align=3Dleft><BR></DIV>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B> John and Pip =
[mailto:pipandjohn@gmail.com]=20
<BR><B>Sent:</B> Wednesday, July 18, 2007 1:06 PM<BR><B>To:</B>=20
webtest@gate2.canoo.com; Scott Glaser<BR><B>Cc:</B>=20
webtest@gate2.canoo.com<BR><B>Subject:</B> Re: [Webtest] How to decipher =
error=20
output?<BR></FONT><BR></DIV>
<DIV></DIV>Hi Scott,<BR><BR>The first thing to do is check whether there =
is=20
actually a javascript error in your web site, which is what the message =
below=20
means. e.g. in Firefox go to Tools/Error=20
Console<BR><BR>regards,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
John=20
<BR><BR>
<DIV><SPAN class=3Dgmail_quote>On 7/19/07, <B =
class=3Dgmail_sendername>Scott=20
Glaser</B> &lt;<A=20
href=3D"mailto:sglaser@yahoo-inc.com">sglaser@yahoo-inc.com</A>&gt; =
wrote:</SPAN>
<BLOCKQUOTE class=3Dgmail_quote=20
style=3D"PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: =
rgb(204,204,204) 1px solid">
  <DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>
  <DIV><FONT face=3DArial size=3D2><FONT face=3DArial =
size=3D2><SPAN>While running the=20
  following webtest script I get the below error. Any ideas why I'm =
getting the=20
  assertion failure for the invoke step indicated? Since I'm new to =
webtest I=20
  don't know how to generate more informative output to debug the=20
  problem.</SPAN></FONT></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2><FONT face=3DArial=20
  size=3D2><SPAN></SPAN></FONT></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2><FONT face=3DArial size=3D2><SPAN>
  <DIV><FONT size=3D+0><SPAN><FONT face=3DArial=20
  size=3D2>Scott</FONT></SPAN></FONT></DIV>
  <DIV><FONT size=3D+0><SPAN><FONT face=3DArial=20
  size=3D2></FONT></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D+0><SPAN><FONT face=3DArial size=3D2>&lt;project =
name=3D"SimpleTest"=20
  basedir=3D"." default=3D"main"&gt;</FONT></SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D+0><SPAN><FONT face=3DArial size=3D2>&nbsp; =
&lt;property=20
  name=3D"webtest.home" location=3D"/home/sglaser/util/webtest-2.1" =
/&gt;<BR>&nbsp;=20
  &lt;import=20
  =
file=3D"${webtest.home}/lib/taskdef.xml"/&gt;</FONT></SPAN></FONT></DIV>
  <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
  <DIV><FONT size=3D+0><SPAN><FONT face=3DArial size=3D2>&nbsp; =
&lt;target=20
  name=3D"main"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;webtest=20
  name=3D"myTest"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &lt;config<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  protocol=3D"https"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
host=3D"<A=20
  onclick=3D"return top.js.OpenExtLink(window,event,this)"=20
  href=3D"http://login11.marketingsolutions.yahoo.com"=20
  =
target=3D_blank>login11.marketingsolutions.yahoo.com</A>"<BR>&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  port=3D"443"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
basepath=3D"adui"=20
  /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &lt;steps&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &lt;invoke<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  description=3D"get login=20
  page"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  url=3D"signin/loadSignin.do" =
/&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  =
&lt;verifyTitle<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
  description=3D"verify=20
  title"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
text=3D"New=20
  Sponsored Search Login" /&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
  &lt;/steps&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;/webtest&gt;<BR>&nbsp;=20
  =
&lt;/target&gt;<BR>&lt;/project&gt;</FONT></SPAN></FONT></DIV></SPAN></FO=
NT></FONT></DIV></DIV>
  <DIV><FONT face=3DArial size=3D2><SPAN></SPAN></FONT>&nbsp;</DIV>
  <DIV><FONT face=3DArial size=3D2>main:<BR>&nbsp;&nbsp; [invoke]=20
  java.lang.IllegalStateException: FAILED ASSERTION<BR>&nbsp;&nbsp;=20
  [invoke]&nbsp;&nbsp;&nbsp;&nbsp; at=20
  org.mozilla.javascript.Kit.codeBug(Kit.java:477)<BR>&nbsp;&nbsp;=20
  [invoke]&nbsp;&nbsp;&nbsp;&nbsp; at=20
  =
org.mozilla.javascript.Interpreter.increaseICodeCapasity(Interpreter.java=
:1707)<BR>&nbsp;&nbsp;=20
  [invoke]&nbsp;&nbsp;&nbsp;&nbsp; at=20
  =
org.mozilla.javascript.Interpreter.recordJump(Interpreter.java:1529)<BR>&=
nbsp;&nbsp;=20
  [invoke]&nbsp;&nbsp;&nbsp;&nbsp; at=20
  =
org.mozilla.javascript.Interpreter.addGoto(Interpreter.java:1459)<BR>&nbs=
p;&nbsp;=20
  [invoke]&nbsp;&nbsp;&nbsp;&nbsp; at=20
  =
org.mozilla.javascript.Interpreter.visitStatement(Interpreter.java:722)</=
FONT></DIV>
  <DIV><SPAN></SPAN><FONT face=3DArial size=3D2>&nbsp;<SPAN>&nbsp;=20
  ...</SPAN><BR><BR>BUILD=20
  FAILED<BR>/home/sglaser/util/webtest-2.1/doc/samples/SimpleTest.xml:7: =
Canoo=20
  Webtest: R_1393.<BR>Test failed.<BR>Test step invoke=20
  (/home/sglaser/util/webtest-2.1/doc/samples/SimpleTest.xml:16: )&nbsp; =
named=20
  "get login&nbsp;&nbsp; page" failed with message "Step[invoke "get =
login page"=20
  (1/2)]: Script error loading page executing&nbsp;&nbsp; webtest at: =
invoke=20
  FAILED ASSERTION</FONT><FONT=20
size=3D+0></FONT></DIV></DIV></BLOCKQUOTE></DIV><BR></BODY></HTML>

------=_NextPart_000_0097_01C7C9E2.6D5E0AA0--