Hello,

 

I am facing issue with recognizing parameter passed to setTimeout() function
in javascript using webtest.

 

setTimeout() functions first parameter is some expression which will get
invoked after the time specified as second parameter. I have a function
called delay as

 

function delay(param)

{

..

..

}

 

Function doSave()

{

     setTimeout("delay(100)", 1000);

}

 

When executed through webtest, I get an exception below. Is setTimeout not
supported through current javascript engine? How can this get working with
webtest?

 

 

[clickLink] ERROR (com.gargoylesoftware.htmlunit.JavaScriptBackgroundJob) -
Caught exception in Window.setTimeout()

[clickLink] ======= EXCEPTION START ========

[clickLink] EcmaError: lineNumber=[1] column=[0] lineSource=[<no source>]
name=[ReferenceError] sourceName=[JavaScriptBackgroundJob]
message=[ReferenceError: "delay" is not defined.
(JavaScriptBackgroundJob#1)]

[clickLink] com.gargoylesoftware.htmlunit.ScriptException: ReferenceError:
"delay" is not defined. (JavaScriptBackgroundJob#1)

[clickLink]     at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAct
ion.run(JavaScriptEngine.java:553)

[clickLink]     at org.mozilla.javascript.Context.call(Context.java:499)

[clickLink]     at
org.mozilla.javascript.ContextFactory.call(ContextFactory.java:511)

[clickLink]     at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:436)

[clickLink]     at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:411)

[clickLink]     at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:935)

[clickLink]     at
com.gargoylesoftware.htmlunit.JavaScriptBackgroundJob.run(JavaScriptBackgrou
ndJob.java:114)

[clickLink]     at java.lang.Thread.run(Unknown Source)

[clickLink]     at
com.gargoylesoftware.htmlunit.ThreadManager$1.run(ThreadManager.java:130)

[clickLink] Caused by: org.mozilla.javascript.EcmaError: ReferenceError:
"delay" is not defined. (JavaScriptBackgroundJob#1)

[clickLink]     at
org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3557)

 

Thanks

Jaydeep

 

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

Reply via email to