[Webtest] How-To ignore VBScript code using WebTest

Marc Guillemot Marc Guillemot <mguillemot@yahoo.fr>
Mon, 18 Aug 2008 09:15:57 +0200


Hi,

as you see when "Script is not JavaScript (type: , language: VBScript).
Skipping execution" is printed on the log, 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.

Cheers,
Marc.
-- 
Blog: http://mguillem.wordpress.com


Alan Guedeney wrote:
> 
> This is the simple login test case script:
> 
> <webtest name="Valid - Login to PFW's website">
>       <config basepath="">
>             <header name="User-Agent" value="Mozilla/4.0 (compatible;
> MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727;
> InfoPath.1)"/>           
>       </config>       
>       &Login;           
>       <setInputField name="username" value="joe" />
>       <setInputField name="password" value="welcome" />
>       <clickButton label="Submit" />
> </webtest>
> 
> Upon execution I get an WARN: "Script is not JavaScript (type: ,
> 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, but at the moment I need it to
> **ignore VBScript**.
> 
> [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: , language: VBScript). Skipping execution.
> INFO (com.canoo.webtest.engine.WebClientContext) - Responses restored
> 
> The test fails with this error:
> JavaScript error loading page
> https://mywebsite.com/login?login:username=: ReferenceError:
> "VBgetAcrobat" is not defined. (https://mywebsite.com/login.js#108)
> 
> Is there anyway around this?  I looked at the documentation and could
> not find any flags or other information to ignore embedded VBScript.
> 
> Thanks!
> 
> 
>