[Webtest] How-To ignore VBScript code using WebTest

Alan Guedeney Alan Guedeney <aguedeney@hotmail.com>
Mon, 18 Aug 2008 09:23:04 -0500


--_c1e23608-7243-496d-9f4e-6237dca92369_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Thanks Marc=2C

Yes=2C it looks like HtmlUnit has a parsing error that does not ignore well=
. The warning leads you to believe that it did ignore the VBScript when it =
really did not.

I've decided to use IeUnit instead of WebTest to overcome these problems fo=
r now.


> From: mguillemot@yahoo.fr
> To: webtest@lists.canoo.com
> Subject: Re: [Webtest] How-To ignore VBScript code using WebTest
> Date: Mon=2C 18 Aug 2008 09:15:57 +0200
>=20
> Hi=2C
>=20
> as you see when "Script is not JavaScript (type: =2C language: VBScript).
> Skipping execution" is printed on the log=2C VBScript are ignored by
> HtmlUnit. In you case the problem is that some JavaScript function wants
> to call a function normally defined in VBScript (here VBgetAcrobat)
> which is not defined when HtmlUnit executes the script due to the fact
> that it has been skipped. Maybe could HtmlUnIt perform a minimal parsing
> of VBScript to catch function definitions to be able to define them with
> empty body but it would probably just postpone a bit the problem.
>=20
> Cheers=2C
> Marc.
> --=20
> Blog: http://mguillem.wordpress.com
>=20
>=20
> Alan Guedeney wrote:
> >=20
> > This is the simple login test case script:
> >=20
> > <webtest name=3D"Valid - Login to PFW's website">
> >       <config basepath=3D"">
> >             <header name=3D"User-Agent" value=3D"Mozilla/4.0 (compatibl=
e=3B
> > MSIE 7.0=3B Windows NT 5.1=3B .NET CLR 1.1.4322=3B .NET CLR 2.0.50727=
=3B
> > InfoPath.1)"/>          =20
> >       </config>      =20
> >       &Login=3B          =20
> >       <setInputField name=3D"username" value=3D"joe" />
> >       <setInputField name=3D"password" value=3D"welcome" />
> >       <clickButton label=3D"Submit" />
> > </webtest>
> >=20
> > Upon execution I get an WARN: "Script is not JavaScript (type: =2C
> > language: VBScript). Skipping execution" that seems to indicate I have
> > VBScript code.  The page uses VBScript code to load an acrobat plugin.
> > One day we'll make this javascript code=2C but at the moment I need it =
to
> > **ignore VBScript**.
> >=20
> > [steps]   INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: steps
> > "Implicit <steps> task" (1/5)
> > [invoke]  INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: invoke
> > "Login page" (1/5)
> > [invoke]  INFO (com.canoo.webtest.steps.request.TargetHelper) - getting
> > response for url: https://mywebsite.com
> > [invoke]  WARN (com.gargoylesoftware.htmlunit.html.HtmlScript) - Script
> > is not JavaScript (type: =2C language: VBScript). Skipping execution.
> > INFO (com.canoo.webtest.engine.WebClientContext) - Responses restored
> >=20
> > The test fails with this error:
> > JavaScript error loading page
> > https://mywebsite.com/login?login:username=3D: ReferenceError:
> > "VBgetAcrobat" is not defined. (https://mywebsite.com/login.js#108)
> >=20
> > Is there anyway around this?  I looked at the documentation and could
> > not find any flags or other information to ignore embedded VBScript.
> >=20
> > Thanks!
> >=20
> >=20
> >=20
>=20
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest

--_c1e23608-7243-496d-9f4e-6237dca92369_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style>
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt=3B
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
<span style=3D"font-family: Courier New=2CCourier=2CMonospace=3B">Thanks Ma=
rc=2C<br><br>Yes=2C it looks like HtmlUnit has a parsing error that does no=
t ignore well. The warning leads you to believe that it did ignore the VBSc=
ript when it really did not.<br><br>I've decided to use IeUnit instead of W=
ebTest to overcome these problems for now.<br><br></span><br>&gt=3B From: m=
guillemot@yahoo.fr<br>&gt=3B To: webtest@lists.canoo.com<br>&gt=3B Subject:=
 Re: [Webtest] How-To ignore VBScript code using WebTest<br>&gt=3B Date: Mo=
n=2C 18 Aug 2008 09:15:57 +0200<br>&gt=3B <br>&gt=3B Hi=2C<br>&gt=3B <br>&g=
t=3B as you see when "Script is not JavaScript (type: =2C language: VBScrip=
t).<br>&gt=3B Skipping execution" is printed on the log=2C VBScript are ign=
ored by<br>&gt=3B HtmlUnit. In you case the problem is that some JavaScript=
 function wants<br>&gt=3B to call a function normally defined in VBScript (=
here VBgetAcrobat)<br>&gt=3B which is not defined when HtmlUnit executes th=
e script due to the fact<br>&gt=3B that it has been skipped. Maybe could Ht=
mlUnIt perform a minimal parsing<br>&gt=3B of VBScript to catch function de=
finitions to be able to define them with<br>&gt=3B empty body but it would =
probably just postpone a bit the problem.<br>&gt=3B <br>&gt=3B Cheers=2C<br=
>&gt=3B Marc.<br>&gt=3B -- <br>&gt=3B Blog: http://mguillem.wordpress.com<b=
r>&gt=3B <br>&gt=3B <br>&gt=3B Alan Guedeney wrote:<br>&gt=3B &gt=3B <br>&g=
t=3B &gt=3B This is the simple login test case script:<br>&gt=3B &gt=3B <br=
>&gt=3B &gt=3B &lt=3Bwebtest name=3D"Valid - Login to PFW's website"&gt=3B<=
br>&gt=3B &gt=3B       &lt=3Bconfig basepath=3D""&gt=3B<br>&gt=3B &gt=3B   =
          &lt=3Bheader name=3D"User-Agent" value=3D"Mozilla/4.0 (compatible=
=3B<br>&gt=3B &gt=3B MSIE 7.0=3B Windows NT 5.1=3B .NET CLR 1.1.4322=3B .NE=
T CLR 2.0.50727=3B<br>&gt=3B &gt=3B InfoPath.1)"/&gt=3B           <br>&gt=
=3B &gt=3B       &lt=3B/config&gt=3B       <br>&gt=3B &gt=3B       &amp=3BL=
ogin=3B           <br>&gt=3B &gt=3B       &lt=3BsetInputField name=3D"usern=
ame" value=3D"joe" /&gt=3B<br>&gt=3B &gt=3B       &lt=3BsetInputField name=
=3D"password" value=3D"welcome" /&gt=3B<br>&gt=3B &gt=3B       &lt=3BclickB=
utton label=3D"Submit" /&gt=3B<br>&gt=3B &gt=3B &lt=3B/webtest&gt=3B<br>&gt=
=3B &gt=3B <br>&gt=3B &gt=3B Upon execution I get an WARN: "Script is not J=
avaScript (type: =2C<br>&gt=3B &gt=3B language: VBScript). Skipping executi=
on" that seems to indicate I have<br>&gt=3B &gt=3B VBScript code.  The page=
 uses VBScript code to load an acrobat plugin.<br>&gt=3B &gt=3B One day we'=
ll make this javascript code=2C but at the moment I need it to<br>&gt=3B &g=
t=3B **ignore VBScript**.<br>&gt=3B &gt=3B <br>&gt=3B &gt=3B [steps]   INFO=
 (com.canoo.webtest.steps.Step) - &gt=3B&gt=3B&gt=3B&gt=3B Start Step: step=
s<br>&gt=3B &gt=3B "Implicit &lt=3Bsteps&gt=3B task" (1/5)<br>&gt=3B &gt=3B=
 [invoke]  INFO (com.canoo.webtest.steps.Step) - &gt=3B&gt=3B&gt=3B&gt=3B S=
tart Step: invoke<br>&gt=3B &gt=3B "Login page" (1/5)<br>&gt=3B &gt=3B [inv=
oke]  INFO (com.canoo.webtest.steps.request.TargetHelper) - getting<br>&gt=
=3B &gt=3B response for url: https://mywebsite.com<br>&gt=3B &gt=3B [invoke=
]  WARN (com.gargoylesoftware.htmlunit.html.HtmlScript) - Script<br>&gt=3B =
&gt=3B is not JavaScript (type: =2C language: VBScript). Skipping execution=
.<br>&gt=3B &gt=3B INFO (com.canoo.webtest.engine.WebClientContext) - Respo=
nses restored<br>&gt=3B &gt=3B <br>&gt=3B &gt=3B The test fails with this e=
rror:<br>&gt=3B &gt=3B JavaScript error loading page<br>&gt=3B &gt=3B https=
://mywebsite.com/login?login:username=3D: ReferenceError:<br>&gt=3B &gt=3B =
"VBgetAcrobat" is not defined. (https://mywebsite.com/login.js#108)<br>&gt=
=3B &gt=3B <br>&gt=3B &gt=3B Is there anyway around this?  I looked at the =
documentation and could<br>&gt=3B &gt=3B not find any flags or other inform=
ation to ignore embedded VBScript.<br>&gt=3B &gt=3B <br>&gt=3B &gt=3B Thank=
s!<br>&gt=3B &gt=3B <br>&gt=3B &gt=3B <br>&gt=3B &gt=3B <br>&gt=3B <br>&gt=
=3B _______________________________________________<br>&gt=3B WebTest maili=
ng list<br>&gt=3B WebTest@lists.canoo.com<br>&gt=3B http://lists.canoo.com/=
mailman/listinfo/webtest<br></body>
</html>=

--_c1e23608-7243-496d-9f4e-6237dca92369_--