Another error...
I was able to fix the problem using this code in the config:
<config>
<option name="ThrowExceptionOnScriptError"
value="false"/>
</config>
However, when I click on the button I get a "Please Wait" screen which
comes up while the page is loading. The 'resulting page' of the button
click is just the "Please Wait" screen instead of the actual page which
loads afterwards, so Webtest can't find any of the form elements I am
trying to fill in on this page.
Anyone have any suggestions? I tried looking through the documentation
for this and couldn't find anything.
Alex
_____________________________________________
From: Alex Ignatov
Sent: Thursday, October 08, 2009 4:01 PM
To: '[email protected]'
Subject: JavaScript error...
Hey,
I just started using webtest. I am running a demo test for State Farm on
a form on their own website: http://www.statefarm.com.
This may sound somewhat odd, but security on the computer I am using
does not allow access to any website except statefarm.com through
Webtest.
When I invoke http://www.statefarm.com using
<invoke url="https://statefarm.com"
description="Go to State Farm"/>
I get an error because there is a small image on the bottom of the page
which is loaded from a different website, so the result is
"JavaScript error loading page http://www.statefarm.com/:
ReferenceError: "DisplayImg" is not defined. (script in
http://www.statefarm.com/ from (856, 32) to (856, 61)#856)"
It doesn't actually matter for the test that this happens because this
piece of JavaScript is completely irrelevant to the form I am trying to
access on the page.. However, the Invoke step fails and the test stops
running.
The only workaround I found for this is to disable Javascript before the
Invoke and enable is again after the Invoke, like so:
<enableJavaScript enable="false"/>
<invoke url="https://statefarm.com"
description="Go to State Farm"/>
<enableJavaScript enable="true"/>
<setInputField htmlid="sZip" value="60630" />
<clickButton htmlid="getRateQuoteGo" />
However, this causes an error in the "getRateQuoteGo" button click
because it references javascript which wasn't loaded when I invoked the
page.
Anyone know a way I can solve this? Can I somehow just ignore the
javascript ReferenceError?
Thanks,
Alex