|
From: David G. <DGo...@qr...> - 2003-03-31 19:51:21
|
I appear to be getting an error because a Javascript method I'm defining
(trim()) is is remaining undefined when called. I've set my web client to
IE6 (wc = new WebClient(BrowserVersion.INTERNET_EXPLORER_6_0);).
=====
This method is imported into my JSP page:
=====
function errorcheck()
{
var action = document.CT3AForm.ACTION_FLAG.value.trim(); <!-- Error
occurs here apparently -->
var allErrorCodes = document.CT3AForm.ERROR_CODE.value.trim();
var allErrorMessages =
document.CT3AForm.PAGE_ERROR_MESSAGE.value.trim();
}
=====
This Javascript from the "HM_Loader.js" file is also imported into my JSP
page:
=====
HM_DOM = (document.getElementById) ? true : false;
HM_NS4 = (document.layers) ? true : false;
HM_IE = (document.all) ? true : false;
HM_IE4 = HM_IE && !HM_DOM;
HM_Mac = (navigator.appVersion.indexOf("Mac") != -1);
HM_IE4M = HM_IE4 && HM_Mac;
HM_IsMenu = (HM_DOM || HM_NS4 || (HM_IE4 && !HM_IE4M));
if(HM_IsMenu) {
document.write("<SCR" + "IPT LANGUAGE='JavaScript1.2'
SRC='/QRSGUI/rockworld/javascript/HM_Script"+ HM_BrowserString +".js'
TYPE='text/javascript'><\/SCR" + "IPT>"); }
=====
Now, what may be happening is that the HM_IsMenu variable is false,
so document.write is never called. Since document.write is never called,
the HM_ScriptIE4.js script import never happens ('IE4' being the value of
the HM_BrowserString variable). Since the HM_ScriptIE4.js script import
never happens, the following code residing in the HM_ScriptIE4.js file is
never imported into the JSP file:
=====
String.prototype.trim = HM_f_StringTrim;
function HM_f_StringTrim(){
var TestString = this;
var SpaceChar = " ";
while (TestString.charAt(0) == SpaceChar) {TestString =
TestString.substr(1)};
while (TestString.charAt(TestString.length-1) == SpaceChar)
{TestString = TestString.substr(0,TestString.length-1)};
return TestString.toString();
}
=====
The other possibilities are that HM_IsMenu is true but that HtmlUnit doesn't
handle function prototyping like defining trim(), or that one imported
Javascript page cannot call a method that resides in another imported
Javascript page.
The bottom line is that I get the following HtmlUnit error when I get the
page:
======= EXCEPTION START ========
Exception class=[org.mozilla.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException:
com.gargoylesoftware.htmlunit.ScriptException: undefined is not a function.
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:196)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInp
ut.java:60)
at
com.gargoylesoftware.htmlunit.html.HtmlInput.click(HtmlInput.java:87)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:
47)
at
TestAddSelectionCode.testAddSelectionCode(TestAddSelectionCode.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
JavaScriptException value = ======= EXCEPTION START ========
EcmaError: lineNumber=[250] column=[0] lineSource=[null] name=[TypeError]
sourceName=[/QRSGUI/rockworld/javascript/AddSelectionCode.js]
message=[undefined is not a function.] errorObject=[TypeError: undefined is
not a function.]
com.gargoylesoftware.htmlunit.ScriptException: undefined is not a function.
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:199)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:88)
at
com.gargoylesoftware.htmlunit.javascript.host.Form.jsFunction_submit(Form.ja
va:252)
at inv12.invoke()
at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:498)
at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at org.mozilla.javascript.gen.c170.call(Embedded script:236)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at
org.mozilla.javascript.gen.c150.call(/QRSGUI/rockworld/javascript/SelCodeLis
t.js:674)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c184.call(body.onLoad:1)
at org.mozilla.javascript.gen.c184.exec(body.onLoad)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:191)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInp
ut.java:60)
at
com.gargoylesoftware.htmlunit.html.HtmlInput.click(HtmlInput.java:87)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:
47)
at
TestAddSelectionCode.testAddSelectionCode(TestAddSelectionCode.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
Enclosed exception:
TypeError: undefined is not a function.
(/QRSGUI/rockworld/javascript/AddSelectionCode.js; line 250)
at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)
at
org.mozilla.javascript.NativeGlobal.typeError1(NativeGlobal.java:567)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1182)
at
org.mozilla.javascript.gen.c283.call(/QRSGUI/rockworld/javascript/AddSelecti
onCode.js:250)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c307.call(body.onLoad:1)
at org.mozilla.javascript.gen.c307.exec(body.onLoad)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:191)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:88)
at
com.gargoylesoftware.htmlunit.javascript.host.Form.jsFunction_submit(Form.ja
va:252)
at inv12.invoke()
at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:498)
at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at org.mozilla.javascript.gen.c170.call(Embedded script:236)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at
org.mozilla.javascript.gen.c150.call(/QRSGUI/rockworld/javascript/SelCodeLis
t.js:674)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c184.call(body.onLoad:1)
at org.mozilla.javascript.gen.c184.exec(body.onLoad)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:191)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInp
ut.java:60)
at
com.gargoylesoftware.htmlunit.html.HtmlInput.click(HtmlInput.java:87)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:
47)
at
TestAddSelectionCode.testAddSelectionCode(TestAddSelectionCode.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
== CALLING JAVASCRIPT ==
errorcheck(event)
======= EXCEPTION END ========
== CALLING JAVASCRIPT ==
initPage()
======= EXCEPTION END ========
This all appears to work fine browsing the page with IE5. Thanks a ton if
you've gotten to the bottom of this email!
-dmg
HTML:
<script src="/QRSGUI/rockworld/javascript/AddSelectionCode.js"></script>
<body bgcolor="#ffffff" leftmargin="0" topmargin="1" marginwidth="0"
marginheight="1" onload="errorcheck(event)">
<form name="CT3AForm" method="post" action="/addselectioncode">
Javascript:
//to display the error messages
function errorcheck()
{
var action = document.CT3AForm.ACTION_FLAG.value.trim();
<!-- This is line 250, where the error
var allErrorCodes =
document.CT3AForm.ERROR_CODE.value.trim();
var allErrorMessages =
document.CT3AForm.PAGE_ERROR_MESSAGE.value.trim();
}
Java error:
======= EXCEPTION START ========
Exception class=[org.mozilla.javascript.JavaScriptException]
com.gargoylesoftware.htmlunit.ScriptException:
com.gargoylesoftware.htmlunit.ScriptException: undefined is not a function.
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:196)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInp
ut.java:60)
at
com.gargoylesoftware.htmlunit.html.HtmlInput.click(HtmlInput.java:87)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:
47)
at
TestAddSelectionCode.testAddSelectionCode(TestAddSelectionCode.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
JavaScriptException value = ======= EXCEPTION START ========
EcmaError: lineNumber=[250] column=[0] lineSource=[null] name=[TypeError]
sourceName=[/QRSGUI/rockworld/javascript/AddSelectionCode.js]
message=[undefined is not a function.] errorObject=[TypeError: undefined is
not a function.]
com.gargoylesoftware.htmlunit.ScriptException: undefined is not a function.
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:199)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:88)
at
com.gargoylesoftware.htmlunit.javascript.host.Form.jsFunction_submit(Form.ja
va:252)
at inv12.invoke()
at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:498)
at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at org.mozilla.javascript.gen.c170.call(Embedded script:236)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at
org.mozilla.javascript.gen.c150.call(/QRSGUI/rockworld/javascript/SelCodeLis
t.js:674)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c184.call(body.onLoad:1)
at org.mozilla.javascript.gen.c184.exec(body.onLoad)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:191)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInp
ut.java:60)
at
com.gargoylesoftware.htmlunit.html.HtmlInput.click(HtmlInput.java:87)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:
47)
at
TestAddSelectionCode.testAddSelectionCode(TestAddSelectionCode.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
Enclosed exception:
TypeError: undefined is not a function.
(/QRSGUI/rockworld/javascript/AddSelectionCode.js; line 250)
at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:597)
at
org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:557)
at
org.mozilla.javascript.NativeGlobal.typeError1(NativeGlobal.java:567)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1182)
at
org.mozilla.javascript.gen.c283.call(/QRSGUI/rockworld/javascript/AddSelecti
onCode.js:250)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c307.call(body.onLoad:1)
at org.mozilla.javascript.gen.c307.exec(body.onLoad)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:191)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:88)
at
com.gargoylesoftware.htmlunit.javascript.host.Form.jsFunction_submit(Form.ja
va:252)
at inv12.invoke()
at
org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:498)
at
org.mozilla.javascript.FunctionObject.call(FunctionObject.java:413)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at org.mozilla.javascript.gen.c170.call(Embedded script:236)
at
org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1191)
at
org.mozilla.javascript.gen.c150.call(/QRSGUI/rockworld/javascript/SelCodeLis
t.js:674)
at
org.mozilla.javascript.optimizer.OptRuntime.callSimple(OptRuntime.java:275)
at org.mozilla.javascript.gen.c184.call(body.onLoad:1)
at org.mozilla.javascript.gen.c184.exec(body.onLoad)
at org.mozilla.javascript.Context.evaluateReader(Context.java:820)
at org.mozilla.javascript.Context.evaluateString(Context.java:784)
at
com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScript
Engine.java:191)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeJavaScriptIfPossible(Html
Page.java:770)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.executeBodyOnLoadHandlerIfNeeded
(HtmlPage.java:900)
at
com.gargoylesoftware.htmlunit.html.HtmlPage.initialize(HtmlPage.java:134)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:322)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:242)
at
com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:137)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.doClickAction(HtmlImageInp
ut.java:60)
at
com.gargoylesoftware.htmlunit.html.HtmlInput.click(HtmlInput.java:87)
at
com.gargoylesoftware.htmlunit.html.HtmlImageInput.click(HtmlImageInput.java:
47)
at
TestAddSelectionCode.testAddSelectionCode(TestAddSelectionCode.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at junit.textui.TestRunner.doRun(TestRunner.java:116)
at junit.textui.TestRunner.start(TestRunner.java:172)
at
com.intellij.rt.execution.junit.TextTestRunner.main(TextTestRunner.java:12)
== CALLING JAVASCRIPT ==
errorcheck(event)
======= EXCEPTION END ========
== CALLING JAVASCRIPT ==
initPage()
======= EXCEPTION END ========
=======================
David M. Goudreau
Senior QA Automation Engineer
QRS Corporation
1400 Marina Way South
Richmond, CA 94804 USA
t: 510-965-4742
f: 510-621-4742
DGo...@qr...
http://www.qrs.com
=======================
|
|
From: Mike B. <mb...@Ga...> - 2003-03-31 20:25:32
|
I would expect that your code to identify which browser is in use will
give you the wrong result. Even though you can specify which browser
version you're using, HtmlUnit doesn't fully implement all the browser
specific behaviour. Some parts will work, some won't.
> HM_DOM = (document.getElementById) ? true : false;
> HM_NS4 = (document.layers) ? true : false;
> HM_IE = (document.all) ? true : false;
> HM_IE4 = HM_IE && !HM_DOM;
> HM_Mac = (navigator.appVersion.indexOf("Mac") != -1);
> HM_IE4M = HM_IE4 && HM_Mac;
> HM_IsMenu = (HM_DOM || HM_NS4 || (HM_IE4 && !HM_IE4M));
Off the top of my head...
HM_DOM will be true
HM_NS4 will be false
HM_IE will be true
HM_Mac will be false
So document.write() should get executed.
> The other possibilities are that HM_IsMenu is true but that HtmlUnit
> doesn't handle function prototyping like defining trim(),
That would be up to the rhino engine and honestly I have no idea if it
does or not. I didn't even know you could do that.
> or that one
> imported Javascript page cannot call a method that resides in another
> imported Javascript page.
That should work.
> JavaScriptException value = ======= EXCEPTION START ========
> EcmaError: lineNumber=[250] column=[0] lineSource=[null] name=[TypeError]
> sourceName=[/QRSGUI/rockworld/javascript/AddSelectionCode.js]
> message=[undefined is not a function.] errorObject=[TypeError:
undefined is
> not a function.]
What is on line 250 of /QRSGUI/rockworld/javascript/AddSelectionCode.js?
Is that the errorCheck() method you included earlier?
--
Mike Bowler
Principal, Gargoyle Software Inc.
Voice: (416) 822-0973 | Email : mb...@Ga...
Fax : (416) 822-0975 | Website: http://www.GargoyleSoftware.com
|