File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Testing and the fly likes com.gargoylesoftware.htmlunit.ScriptException: TypeError: is not a function, it is undefined Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "com.gargoylesoftware.htmlunit.ScriptException: TypeError: is not a function, it is undefined" Watch "com.gargoylesoftware.htmlunit.ScriptException: TypeError: is not a function, it is undefined" New topic
Author

com.gargoylesoftware.htmlunit.ScriptException: TypeError: is not a function, it is undefined

Hetal Shah
Greenhorn

Joined: Jun 15, 2004
Posts: 10
Hi All,

I am trying to run one webtest and getting following issue

In My web test on click of particular button one javascript funcation is getting clalled which is there in the js file.
By setting the level to debug in the log4j I can see that the particular js which is having that javascript function is getting downloaded then also while executing that function it is giving below error.

The HtmlUnit version which I am using is 2.7

com.gargoylesoftware.htmlunit.ScriptException: TypeError: isWhiteSpace is not a function, it is undefined.
[groovy] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:527)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
[groovy] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:457)
[groovy] at com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptFunctionIfPossible(HtmlPage.java:910)
[groovy] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeEventHandler(EventListenersContainer.java:190)
[groovy] at com.gargoylesoftware.htmlunit.javascript.host.EventListenersContainer.executeBubblingListeners(EventListenersContainer.java:209)
[groovy] at com.gargoylesoftware.htmlunit.javascript.host.Node.fireEvent(Node.java:645)
[groovy] at com.gargoylesoftware.htmlunit.html.HtmlElement$2.run(HtmlElement.java:887)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)
[groovy] at com.gargoylesoftware.htmlunit.html.HtmlElement.fireEvent(HtmlElement.java:892)
[groovy] at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1248)
[groovy] at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1212)
[groovy] at com.gargoylesoftware.htmlunit.html.HtmlElement.click(HtmlElement.java:1179)
[groovy] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[groovy] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[groovy] at java.lang.reflect.Method.invoke(Method.java:585)
[groovy] at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229)
[groovy] at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52)
[groovy] at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
[groovy] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
[groovy] at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:121)
[groovy] at Script1.run(Script1.groovy:10)
[groovy] at groovy.lang.GroovyShell.evaluate(GroovyShell.java:527)
[groovy] at groovy.lang.GroovyShell.evaluate(GroovyShell.java:565)
[groovy] at groovy.lang.GroovyShell.evaluate(GroovyShell.java:536)
[groovy] at com.canoo.webtest.extension.groovy.GroovyInvoker.doExecute(GroovyInvoker.java:40)
[groovy] at com.canoo.webtest.extension.groovy.GroovyStep.doExecute(GroovyStep.java:83)
[groovy] at com.canoo.webtest.steps.Step.execute(Step.java:103)
[groovy] at com.canoo.webtest.extension.groovy.GroovyStep.execute(GroovyStep.java:64)
[groovy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[groovy] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[groovy] at java.lang.reflect.Method.invoke(Method.java:585)
[groovy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[groovy] at org.apache.tools.ant.Task.perform(Task.java:348)
[groovy] at com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java:43)
[groovy] at com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31)
[groovy] at com.canoo.webtest.steps.Step.execute(Step.java:103)
[groovy] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[groovy] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[groovy] at java.lang.reflect.Method.invoke(Method.java:585)
[groovy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[groovy] at org.apache.tools.ant.Task.perform(Task.java:348)
[groovy] at com.canoo.webtest.ant.WebtestTask.executeSteps(WebtestTask.java:293)
[groovy] at com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:218)
[groovy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[groovy] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[groovy] at java.lang.reflect.Method.invoke(Method.java:585)
[groovy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[groovy] at org.apache.tools.ant.Task.perform(Task.java:348)
[groovy] at org.apache.tools.ant.Target.execute(Target.java:357)
[groovy] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[groovy] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[groovy] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
[groovy] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[groovy] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
[groovy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[groovy] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[groovy] at java.lang.reflect.Method.invoke(Method.java:585)
[groovy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[groovy] at org.apache.tools.ant.Task.perform(Task.java:348)
[groovy] at org.apache.tools.ant.Target.execute(Target.java:357)
[groovy] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[groovy] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[groovy] at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
[groovy] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[groovy] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
[groovy] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[groovy] at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
[groovy] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[groovy] at java.lang.reflect.Method.invoke(Method.java:585)
[groovy] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
[groovy] at org.apache.tools.ant.Task.perform(Task.java:348)
[groovy] at org.apache.tools.ant.Target.execute(Target.java:357)
[groovy] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[groovy] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
[groovy] at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
[groovy] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[groovy] at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
[groovy] at org.apache.tools.ant.Main.runBuild(Main.java:698)
[groovy] at org.apache.tools.ant.Main.startAnt(Main.java:199)
[groovy] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
[groovy] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
[groovy] Caused by: net.sourceforge.htmlunit.corejs.javascript.EcmaError: TypeError: isWhiteSpace is not a function, it is undefined.
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3753)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3731)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3759)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.typeError2(ScriptRuntime.java:3778)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3833)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1842)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.getNameFunctionAndThis(ScriptRuntime.java:2231)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpretLoop(Interpreter.java:1506)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.Interpreter.interpret(Interpreter.java:845)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.doTopCall(ContextFactory.java:429)
[groovy] at com.gargoylesoftware.htmlunit.javascript.HtmlUnitContextFactory.doTopCall(HtmlUnitContextFactory.java:264)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3157)
[groovy] at net.sourceforge.htmlunit.corejs.javascript.InterpretedFunction.call(InterpretedFunction.java:162)
[groovy] at com.gargoylesoftware.htmlunit.javascript.host.EventHandler.call(EventHandler.java:80)
[groovy] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.callFunction(JavaScriptEngine.java:485)
[groovy] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$4.doRun(JavaScriptEngine.java:450)
[groovy] at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:521)

Can anyone please suggest me what is the issue and how to resolve this?

Thanks & Regards,
Hetal
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: com.gargoylesoftware.htmlunit.ScriptException: TypeError: is not a function, it is undefined