AW: [Webtest] Pausing for Javascript to update the html

Habbert, Michael (Key-Work) Habbert, Michael (Key-Work)" <michael.habbert@key-work.de
Wed, 9 Jan 2013 09:04:06 +0000


--_000_020D1069F2FDF64A9D99558C22CA93A227A0D8ex3_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi Robert,

what does provoke the Java Script to load the "real" page?

You might execute this action with groovy:
<groovy description=3D"execute on blur on element" replaceProperties=3D"tru=
e" >
                step.context.currentResponse.getHtmlElementById('successRat=
eAdjustPerc_101_#{projection_unit_id}').fireEvent("blur")
</groovy>

So your webtest will do the same you application/browser does.

With kind regards

Michael Habbert

[...]
I'm testing an ExtJS application. The HTML loaded has no content other than=
 a reference to the ExtJS Javascript code. So if I just use <invoke> to loa=
d my page its initially blank until the Javascript has a second to update i=
t. Using sleep results in the following message...

"Content of window changed with javascript, it will NOT become current resp=
onse"

However, that is exactly what I want, I want the javascript change to becom=
e the current response. How do I do that??

    <target name=3D"wt.testInWork">
        <webtest name=3D"my simple Test">
            <steps>
                <invoke url=3D"http://localhost:8080/development/commonComp=
onents/superfield/test.html"
                        description=3D"Go to Google (in English)"/>
                <sleep seconds=3D"30"/>
                <verifyText text=3D"SuperField"/> <--- only available after=
 the Javascript has a few seconds to run
            </steps>
        </webtest>
    </target>

-Robert


Michael Habbert
Key-Work Consulting GmbH | Kriegsstr. 100 | 76133 Karlsruhe | Germany | www=
.key-work.de<http://www.key-work.de>
Fon: +49-721-78203-269 | E-Mail: michael.habbert@key-work.de<mailto:michael=
.habbert@key-work.de> | Fax: +49-721-78203-10

Key-Work Consulting GmbH, Karlsruhe, HRB 108695, HRG Mannheim
Gesch=E4ftsf=FChrer: Andreas Stappert, Tobin Wotring

--_000_020D1069F2FDF64A9D99558C22CA93A227A0D8ex3_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Sprechblasentext Zchn";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma","sans-serif";}
p.ecxmsonormal, li.ecxmsonormal, div.ecxmsonormal
	{mso-style-name:ecxmsonormal;
	mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	mso-margin-bottom-alt:auto;
	margin-left:0cm;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
p.ecxmsonormal1, li.ecxmsonormal1, div.ecxmsonormal1
	{mso-style-name:ecxmsonormal1;
	mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
span.ecxmsohyperlink
	{mso-style-name:ecxmsohyperlink;}
span.ecxmsohyperlinkfollowed
	{mso-style-name:ecxmsohyperlinkfollowed;}
span.ecxemailstyle17
	{mso-style-name:ecxemailstyle17;}
span.ecxmsohyperlink1
	{mso-style-name:ecxmsohyperlink1;
	color:blue;
	text-decoration:underline;}
span.ecxmsohyperlinkfollowed1
	{mso-style-name:ecxmsohyperlinkfollowed1;
	color:purple;
	text-decoration:underline;}
span.ecxemailstyle171
	{mso-style-name:ecxemailstyle171;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.E-MailFormatvorlage26
	{mso-style-type:personal;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.E-MailFormatvorlage27
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.SprechblasentextZchn
	{mso-style-name:"Sprechblasentext Zchn";
	mso-style-priority:99;
	mso-style-link:Sprechblasentext;
	font-family:"Tahoma","sans-serif";}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"DE" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">Hi Robert,<o:p></o:p></sp=
an></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">what does provoke the Jav=
a Script to load the &#8222;real&#8220; page?<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">You might execute this ac=
tion with groovy:<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">&lt;groovy description=3D=
&quot;execute on blur on element&quot; replaceProperties=3D&quot;true&quot;=
 &gt;<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; step.cont=
ext.currentResponse.getHtmlElementById('successRateAdjustPerc_101_#{project=
ion_unit_id}').fireEvent(&quot;blur&quot;)<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">&lt;/groovy&gt;<o:p></o:p=
></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">So your webtest will do the same you application/bro=
wser does.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">With kind regards<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">Michael Habbert<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<div>
<p class=3D"MsoNormal" style=3D"margin-bottom:12.0pt"><b><span style=3D"fon=
t-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;;color:b=
lack">[&#8230;]</span></b><span lang=3D"EN-US"><o:p></o:p></span></p>
<div>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">I&#8217;m testing an ExtJ=
S application. The HTML loaded has no content other than a reference to the=
 ExtJS Javascript code. So if I just use &lt;invoke&gt; to load my page
 its initially blank until the Javascript has a second to update it. Using =
sleep results in the following message&#8230;</span><span lang=3D"EN-US"><o=
:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;</span><span lang=
=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&#8220;Content of window =
changed with javascript, it will NOT become current response&#8221;
</span><span lang=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;</span><span lang=
=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">However, that is exactly =
what I want, I want the javascript change to become the current response. H=
ow do I do that??</span><span lang=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;</span><span lang=
=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp; &lt;ta=
rget name=3D&quot;wt.testInWork&quot;&gt;</span><span lang=3D"EN-US"><o:p><=
/o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; &lt;webtest name=3D&quot;my simple Test&quot;&gt;</span><=
span lang=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;steps&gt;</span><span lang=3D=
"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;invok=
e url=3D&quot;<a href=3D"http://localhost:8080/development/commonComponents=
/superfield/test.html">http://localhost:8080/development/commonComponents/s=
uperfield/test.html</a>&quot;</span><span lang=3D"EN-US"><o:p></o:p></span>=
</p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;description=3D&quot;Go to Google (in=
 English)&quot;/&gt;</span><span lang=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;sleep=
 seconds=3D&quot;30&quot;/&gt;</span><span lang=3D"EN-US"><o:p></o:p></span=
></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;verif=
yText text=3D&quot;SuperField&quot;/&gt;
</span><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-family:Wingdings=
">=DF</span><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-family:&quo=
t;Tahoma&quot;,&quot;sans-serif&quot;">- only available after the Javascrip=
t has a few seconds to run</span><span lang=3D"EN-US"><o:p></o:p></span></p=
>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/steps&gt;</span><span lang=
=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp; &lt;/webtest&gt;</span><span lang=3D"EN-US"><o:p></o:p></=
span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;&nbsp;&nbsp; &lt;/t=
arget&gt;</span><span lang=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">&nbsp;</span><span lang=
=3D"EN-US"><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span lang=3D"EN-US" style=3D"font-size:10.0pt;font-=
family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">-Robert</span><span lang=
=3D"EN-US"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
<div class=3D"Section1">
<p class=3D"MsoNormal"><span style=3D"font-family:Calibri,Arial,Sans-Serif;=
color:#000080">&nbsp;<br>
&nbsp;<br>
<strong>Michael Habbert</strong> <br>
Key-Work Consulting GmbH | Kriegsstr. 100 | 76133 Karlsruhe | Germany | <a =
href=3D"http://www.key-work.de" title=3D"Key-Work Consulting GmbH" target=
=3D"_blank">
www.key-work.de</a><br>
Fon: &#43;49-721-78203-269 | E-Mail: <a href=3D"mailto:michael.habbert@key-=
work.de">michael.habbert@key-work.de</a> | Fax: &#43;49-721-78203-10
<br>
&nbsp;<br>
Key-Work Consulting GmbH, Karlsruhe, HRB 108695, HRG Mannheim<br>
Gesch=E4ftsf=FChrer: Andreas Stappert, Tobin Wotring </span><o:p></o:p></p>
</div>
</body>
</html>

--_000_020D1069F2FDF64A9D99558C22CA93A227A0D8ex3_--