I have a page in which a couple of javascript functions have been written in the <head></head> section.
I have a link like this one
<a id="testFunctionLink" href="javascript:testFunction()"> HIT ME </a>
I manage to get the link with the ID and click it, but after this, I get the following error:
[java] E
[java] Time: 1.442
[java] There was 1 error:
[java] 1) testSeeIFrame(com.solabs.rip.security.test.TestIFrame)
[java] com.meterware.httpunit.ScriptException: URL 'javascript:testJSFuncti
on();' failed: TypeError: undefined is not a function. (httpunit; line 1)
[java] at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.handleScriptException(JavaScript.java:183)
[java] at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.getURLContents(JavaScript.java:172)
[java] at com.meterware.httpunit.scripting.ScriptableDelegate.evaluateU
RL(ScriptableDelegate.java:64)
[java] at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:1
57)
[java] at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindo
w.java:117)
[java] at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:1
10)
[java] at com.meterware.httpunit.WebWindow.sendRequest(WebWindow.java:9
9)
[java] at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequ
estSource.java:204)
[java] at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequ
estSource.java:195)
[java] at com.meterware.httpunit.WebLink.click(WebLink.java:89)
[java] at com.solabs.rip.security.test.TestIFrame.testSeeIFrame(TestIFr
ame.java:104)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[java] at com.solabs.rip.security.test.TestIFrame.main(TestIFrame.java:
40)
any clues as to what's doing this or how to fix it?
TIA,
pascal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-01-30
ok.. I've found what it was all about.
I was using the document.getElementByID() method in my function, and this is what's causing the "undefined" error.
If I replace it with the "normal" document.form.component approach, it works... any info as to when this will be supported would be great. I kind of really like (and need) the getElementByID method...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a page in which a couple of javascript functions have been written in the <head></head> section.
I have a link like this one
<a id="testFunctionLink" href="javascript:testFunction()"> HIT ME </a>
I manage to get the link with the ID and click it, but after this, I get the following error:
[java] E
[java] Time: 1.442
[java] There was 1 error:
[java] 1) testSeeIFrame(com.solabs.rip.security.test.TestIFrame)
[java] com.meterware.httpunit.ScriptException: URL 'javascript:testJSFuncti
on();' failed: TypeError: undefined is not a function. (httpunit; line 1)
[java] at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.handleScriptException(JavaScript.java:183)
[java] at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine
.getURLContents(JavaScript.java:172)
[java] at com.meterware.httpunit.scripting.ScriptableDelegate.evaluateU
RL(ScriptableDelegate.java:64)
[java] at com.meterware.httpunit.WebWindow.getResource(WebWindow.java:1
57)
[java] at com.meterware.httpunit.WebWindow.getSubframeResponse(WebWindo
w.java:117)
[java] at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:1
10)
[java] at com.meterware.httpunit.WebWindow.sendRequest(WebWindow.java:9
9)
[java] at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequ
estSource.java:204)
[java] at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequ
estSource.java:195)
[java] at com.meterware.httpunit.WebLink.click(WebLink.java:89)
[java] at com.solabs.rip.security.test.TestIFrame.testSeeIFrame(TestIFr
ame.java:104)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
[java] at com.solabs.rip.security.test.TestIFrame.main(TestIFrame.java:
40)
[java] FAILURES!!!
[java] Tests run: 1, Failures: 0, Errors: 1
any clues as to what's doing this or how to fix it?
TIA,
pascal
ok.. I've found what it was all about.
I was using the document.getElementByID() method in my function, and this is what's causing the "undefined" error.
If I replace it with the "normal" document.form.component approach, it works... any info as to when this will be supported would be great. I kind of really like (and need) the getElementByID method...
getElementById support is in cvs and will be included in the next release.