This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Is httpunit support script contains table1 deleteRow( rowno)
akkina sathish
Greenhorn
Joined: Apr 19, 2006
Posts: 24
posted
0
Hi all, Here i am pasting my javascript which contains code to add row to the table. This function will be called when i give click action on a button.
function addRow() { var rowCount=parseInt(document.WorkCalendarsForm.rowCount.value); // RowCount field is useful to create unique names to starttime and endtime fields document.WorkCalendarsForm.rowCount.value=parseInt(document.WorkCalendarsForm.rowCount.value)+1;
var oTab = document.getElementById('CalData'); var temp =oTab.rows.length; document.WorkCalendarsForm.testvar.value = oTab.rows.length; var oRow = oTab.insertRow(oTab.rows.length);
var oCell = oRow.insertCell(0); }
It is giving error at line var temp =oTab.rows.length;
my httpunit code workCalForm.getButtonWithID("addEntry").click();
I have a doubt about whether httpUnit not supporting script functions relating to table operations?.
Anyone who knows about above issue can confirm.
Thanks
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
What kind of error? Are the values of "oTab", "oTab.rows" and "oTab.rows.length" correct?
undefined: The undefined value has no properties. (httpunit; line 131) at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:580) at org.mozilla.javascript.NativeGlobal.constructError(NativeGlobal.java:541) at org.mozilla.javascript.ScriptRuntime.getProp(ScriptRuntime.java:700) at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1806) 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.Button.doOnClickEvent(Button.java:103) at com.meterware.httpunit.Button.click(Button.java:81) at com.actiontech.jmetro.admin.WorkCalendarTest.testWorkDays(WorkCalendarTest.java:413) 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)
akkina sathish
Greenhorn
Joined: Apr 19, 2006
Posts: 24
posted
0
After that i did run this test case by some input values.
By that I can sure you that 'oTab' is getting some html element rather than getting null.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
0
OK, so oTab is valid. How about oTab.rows - does that exist and have a valid value?
akkina sathish
Greenhorn
Joined: Apr 19, 2006
Posts: 24
posted
0
no, oTab.rows giving as 'unDefined'
Lasse Koskela
author
Sheriff
Joined: Jan 23, 2002
Posts: 11962
5
posted
0
Originally posted by akkina sathish: no, oTab.rows giving as 'unDefined'
First of all, I presume that 'CalData' (variable 'oTab') is a table element? If so, you could try referring to "oTab.tBodies[0].rows" instead of "oTab.rows".
I predict that this won't work either, though, because the documentation doesn't mention any support for table DOM objects at all.