aspose file tools*
The moose likes Testing and the fly likes Is httpunit  support script contains table1 deleteRow( rowno) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Is httpunit  support script contains table1 deleteRow( rowno) " Watch "Is httpunit  support script contains table1 deleteRow( rowno) " New topic
Author

Is httpunit support script contains table1 deleteRow( rowno)

akkina sathish
Greenhorn

Joined: Apr 19, 2006
Posts: 24
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: 39578
    
  27
What kind of error? Are the values of "oTab", "oTab.rows" and "oTab.rows.length" correct?


Ping & DNS - updated with new look and Ping home screen widget
akkina sathish
Greenhorn

Joined: Apr 19, 2006
Posts: 24
The following error i am getting:-


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
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: 39578
    
  27
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
no, oTab.rows giving as 'unDefined'
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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.


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
akkina sathish
Greenhorn

Joined: Apr 19, 2006
Posts: 24
can you suggest me any other option for working along with this?.
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
Originally posted by akkina sathish:
can you suggest me any other option for working along with this?.

Try to find another tool to replace HttpUnit--one which uses a different JavaScript implementation than HttpUnit.
 
wood burning stoves
 
subject: Is httpunit support script contains table1 deleteRow( rowno)
 
Similar Threads
how to delete multiple browse
Multiple Select box Problem
Using Up/Down Arrow Key to Move in a table
adding and deleting a row in html
Add & Delete Table rows dynamically