• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not getting modifications in jsp page through httpunit

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Click on one button which raises one window to select some value into textbox besides to it. After that bases on selected value page is getting some new changes. Through httptest case i am not getting those changes.

and see my httpunit test code.

transferForm.getButtonWithID("ownerSelection").click();
WebWindow webWindow[] = AdminTestUtils.webConversation.getOpenWindows();
WebResponse userSelectorPage = AdminTestUtils.webConversation.getOpenWindow("userSelector").getCurrentPage();
WebForm userSelectorForm = userSelectorPage.getFormWithName("userSelectorForm");
userSelectorForm.setParameter("userSelector","Cat");
userSelectorForm.getButtonWithID("ok").click();

In new page i am getting selected value into the selectedProfileOwner textBox but corresponding changes i am not gettig.

Please any one can help to this problem.
Thanks.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You lost me completely there. Could you explain what you're trying to do again in terms of the code you have? For example, referring to variable names rather than "new window" and so forth.
 
akkina sathish
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, actually last time this forum is not posted my code. It is specied that my code has some tags '<' which are not allowble. This time also i dont know whether sending of this new message. ok now i coming to problem

this is httpunit test code

transferForm.setCheckbox("until",true);
transferPage.getLinkWithID("calendarLink").click();

my page contains some textbox besides one 'calendarLink' button. in above httpunit code i am clicking on that button. At bottom i am furnishing my javascript corresponding to my click event. This click function will call one aws_calendar.jsp page. this page contains onload() which will call one local function named as setDate(); Here i am getting the following error at the time of running my httpunit testcase. But through Browser this onclick function is working fine.

see my javscript function


function setDate() {
if(window.dialogArguments!=null) {
parentWinObj = window.dialogArguments;
}else{
parentWinObj = window.opener;
}
styleFlag = document.calControl.style?1:0;
dateObj = parentWinObj.dateObj;
dateField = dateObj.dateField;
dateFormat = dateObj.dateFormat;

dateField = trim(dateField);
if((dateField != null) && (dateField != "") ){
old = new Date(dateField);
}
else {
old = new Date();// set calender to present date.
}

day = old.getDate();
var month = old.getMonth();
var year = old.getFullYear();
setSelectedTime(old);
focusDay = day;
document.calControl.month.selectedIndex = month;
document.calControl.year.value = year;
displayCalendar(day, month, year);
setDateField(day, month,year);

}
The above function related to the page aws_calendar.jsp. If we click 'ok' then it will send selected date to the parent page. First of all at the time of loading this aws_calendar.jsp, this setDate() function is not working.

See my ERROR report i am getting like .The undefined value has no properties.


org.mozilla.javascript.EvaluatorException: The undefined value has no properties.
at org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:61)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:549)
at org.mozilla.javascript.Context.reportRuntimeError(Context.java:587)
at org.mozilla.javascript.Context.reportRuntimeError0(Context.java:557)
at org.mozilla.javascript.Undefined.reportError(Undefined.java:136)
at org.mozilla.javascript.Undefined.getPrototype(Undefined.java:98)
at org.mozilla.javascript.ScriptRuntime.setProp(ScriptRuntime.java:835)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1817)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:88)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1950)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:88)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:172)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
at com.meterware.httpunit.WebResponse$Scriptable.load(WebResponse.java:689)
at com.meterware.httpunit.javascript.JavaScript.load(JavaScript.java:89)
at com.meterware.httpunit.javascript.JavaScriptEngineFactory.load(JavaScriptEngineFactory.java:58)
at com.meterware.httpunit.RequestContext.runScripts(RequestContext.java:44)
at com.meterware.httpunit.WebWindow.getResponse(WebWindow.java:122)
at com.meterware.httpunit.WebResponse$Scriptable.open(WebResponse.java:698)
at com.meterware.httpunit.javascript.JavaScript$Window.jsFunction_open(JavaScript.java:474)
at inv1.invoke()
at org.mozilla.javascript.FunctionObject.doInvoke(FunctionObject.java:517)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:433)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
at org.mozilla.javascript.gen.c3.call(httpunit:19)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1950)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:88)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:172)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
at com.meterware.httpunit.WebLink.click(WebLink.java:98)
at com.actiontech.jmetro.admin.TransferTest.testForFixingProblems(TransferTest.java:101)
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:585)
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 org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:524)
org.mozilla.javascript.JavaScriptException: com.meterware.httpunit.ScriptException: Event 'setDate1()' f
at org.mozilla.javascript.JavaScriptException.wrapException(JavaScriptException.java:78)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:437)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
at org.mozilla.javascript.gen.c3.call(httpunit:19)
at org.mozilla.javascript.ScriptRuntime.call(ScriptRuntime.java:1222)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1950)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:88)
at com.meterware.httpunit.javascript.JavaScript$JavaScriptEngine.performEvent(JavaScript.java:172)
at com.meterware.httpunit.scripting.ScriptableDelegate.doEvent(ScriptableDelegate.java:56)
at com.meterware.httpunit.WebRequestSource.submitRequest(WebRequestSource.java:232)
at com.meterware.httpunit.WebLink.click(WebLink.java:98)
at com.actiontech.jmetro.admin.TransferTest.testForFixingProblems(TransferTest.java:101)
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:585)
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)

******************End test:******************testForFixingProblems

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)
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 3.469 sec
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)


see script i wrote in parent jsp page

calWindowObjRef = window.open('aws_calendar.jsp', "SelectDate","titilebar = no,status=no,toolbar=no,directories=no,menubar=no,scrollbars=no,center=yes,dialog=yes,resizable=yes,modal=yes,dependent=yes,minimizable=no,width=280px,height=440px");

Please any One who knows solution can help me. I spent already 2 days to fix this.But still am not able to resolve.

Thanks.
 
akkina sathish
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry in my above posting 'calendarLink' is not a button, its a link.
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess is that "document.calControl" is the culprit. Reading HttpUnit's JavaScript support documentation, I don't think it supports locating objects by the "document.[id]" syntax. You could try replacing all instances of "document.calControl" with "document.getElementById('calControl')" and see if that helps.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic