Hi Rhee,

You can try adding the following to your <config>:

<config ... >
...     <!-- this option let me ignore Javascript errors-->     <option 
name="ThrowExceptionOnScriptError" value="false"/> ...
</config>

Instead of Webtest failing when a javascript error occurs, the error message 
will be printed to the Webtest output log and the test will continue.  This 
does make it slightly harder to debug failing tests, if a test failed due to 
javascript functions that didn't properly execute.

Cheers,

John Spann | Associate Software Engineer

Citrix Online Division
Citrix Systems, Inc.
6500 Hollister Avenue
Goleta, CA 93117 USA
www.citrix.com

Phone: 805.690.3489
Cell: 805.729.0008
Email: john.sp...@citrix.com

On 3/13/09 2:07 PM, "Rhee" <rhee.kgop...@gmail.com> wrote:

Hi all


After some troubleshooting, I found the offending js that interacts w/ flash.
Excerpt of failing java script and page source;

<script language="JavaScript" type="text/javascript">
if(navigator.appName == "Netscape"){
          
document.WebSubmissionsCandidateProfile.captureEvents(Event.MOUSEDOWN);
          document.WebSubmissionsCandidateProfile.addEventListener("mousedown", 
onNsRightClick, true);
}
else{
          document.WebSubmissionsCandidateProfile.onmousedown=onIeRightClick;
}
</script>

<object height="575" width="100%" 
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"; 
id="WebSubmissionsCandidateProfile" 
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
                <param 
value="/recruitMach/view/Flex/WebSubmissionsCandidateProfile/WebSubmissionsCandidateProfile.swf"
 name="movie"/>
                <param value="high" name="quality"/>
                <param value="#869ca7" name="bgcolor"/>
                <param value="opaque" name="wmode"/>
                <param value="sameDomain" name="allowScriptAccess"/>
                <embed height="575" align="middle" width="100%" 
pluginspage="http://www.adobe.com/go/getflashplayer"; 
type="application/x-shockwave-flash" allowscriptaccess="sameDomain" 
wmode="opaque" quality="high" loop="false" play="true" 
name="WebSubmissionsCandidateProfile" bgcolor="#869ca7" 
src="/recruitMach/view/Flex/WebSubmissionsCandidateProfile/WebSubmissionsCandidateProfile.swf"/>

</object>


Is there a way i can get around this w/ out having dev modify code? and is 
there a way i can dump errors to a log file?

Any suggestions would help.

Thanks
Rhee



---------- Forwarded message ----------
From: Rhee <rhee.kgop...@gmail.com>
Date: Wed, Mar 11, 2009 at 4:10 PM
Subject: Q: Dealing with Java Script errors in WebTest
To: webtest@lists.canoo.com


Hi all

I am getting js script errors in my scripts and I'm unable to get past them. I 
cannot figure out why, please help.

1] I have already established that the app does not work in Firefox.  Js errors 
make it not functional, as a result we support only IE :(
2] Most of the validation in the forms are js and also utilizes Ajax
3] I tried it run it in Webtest w/ out any browser config; it should default to 
IE. Also tried to explicitly add <config browser="IE6" />.
   The errors in the log reference org.mozilla.javascript.EcmaError , does that 
mean it is still trying to simulate FF?
4] To avoid js error, tried to add the following in config and it still does 
not work;

 <option name="ThrowExceptionOnScriptError" value="false"/>
<enableJavaScript enable="false"/>
<easyajax="true"/>

As well as add <sleep description="sleep (10s)" seconds="10"/> after events the 
use ajax

All the steps appear to have passed and the failing step is the final Submit 
action on the form. Even though the submit action step has failed, the 
resulting page is correct and the form is saved successfully. I cannot turn off 
js because the app depends on it.
 <http://webtest-community.canoo.com/jira/browse/WT-378>
I have downloaded WebTest release 3.0


Except from log
*********************************************************************************

[sleep] Exception in thread "HtmlUnit Managed Thread #2 for WebWindow mainrmqa: 
XMLHttpRequest.send" org.mozilla.javascript.EcmaError: TypeError: Cannot call 
property onCompletion in object [object Object].It is not a function, it is 
"undefined". (http://IP address/lib/javascript/ajax/sack.js#115)

    [sleep]     at 
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3654)

(removed steps that passed to shorten log)

[clickButton]  INFO (com.canoo.webtest.steps.request.ClickButton) - -> 
findTarget(by input): name=cmdSubmit value=s a v e ( at this point the form is 
saved, new page should open)

[clickButton]  WARN (com.gargoylesoftware.htmlunit.javascript.host.HTMLDocument)

 - getElementById(txtCity1) did a getElementByName for Internet Explorer

[clickButton]  WARN (com.gargoylesoftware.htmlunit.javascript.host.HTMLDocument)

 - getElementById(txtAddress12) did a getElementByName for Internet Explorer

[clickButton]  WARN (com.gargoylesoftware.htmlunit.javascript.host.HTMLDocument)

 - getElementById(txtZipValid1) did a getElementByName for Internet Explorer

[clickButton]  WARN (com.gargoylesoftware.htmlunit.javascript.host.HTMLDocument)

 - getElementById(txtCity2) did a getElementByName for Internet Explorer

[clickButton]  WARN (com.gargoylesoftware.htmlunit.javascript.host.HTMLDocument)

 - getElementById(txtAddress22) did a getElementByName for Internet Explorer



[clickButton]  WARN (com.gargoylesoftware.htmlunit.html.HtmlPage) - Expected 
content type of 'application/javascript' or 'application/ecmascript' for 
remotely loaded JavaScript element at

'http://IP address/Mach/lib/js/openWindows.js', but got 
'application/x-javascript'.



[clickButton]  WARN (com.gargoylesoftware.htmlunit.html.HtmlPage) - Expected 
content type of 'application/javascript' or 'application/ecmascript' for 
remotely loaded JavaScript element at 'http://IP 
address/Mach/view/Flex/WebSubmissionsCandidateProfile/AC_OETags.js', but got 
'application/x-javascript'.



[clickButton]  WARN (com.gargoylesoftware.htmlunit.html.HtmlPage) - Expected 
content type of 'application/javascript' or 'application/ecmascript' for 
remotely loaded JavaScript element at 'http://IP 
address/lib/javascript/flex/rightClick.js', but got 'application/x-javascript'.

 INFO (com.canoo.webtest.engine.WebClientContext) - Responses restored

 INFO (com.canoo.webtest.ant.WebtestTask) - Finished executing webtest ....

Error Message

Test results Error page after clicking cmdSubmit (location lnine on the script)

JavaScript error loading page http://IP 
address/Mach/index.cfm?event=candidate.displayCandidate&candidateID=xx&newCandOrCont=true:
 TypeError: Cannot set property "onmousedown" of undefined to 
"org.mozilla.javascript.interpretedfunct...@7946a2" (script in http://IP 
address/Mach/index.cfm?event=candidate.displayCandidate&candidateID=xx&newCandOrCont=true
 from (2306, 54) to (2314, 10)#2312)



Another variation of the js error (different page):

JavaScript error loading page http://IP 
address/clientprofile.cfm?szClientID=xx7&szMsg=Company%20added: TypeError: 
Cannot call method "open" of undefined
*********************************************************************************

I hope added just enough information ( not too much) to at least get an idea of 
where the main issue is.

Thanks again.


_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to