Hi Craig,

can you open a bug issue by htmlunit
(http://sourceforge.net/tracker/?group_id=47038&atid=448266) with
exactly the information you provided here? It will be easier for me (or
other htmlunit committer) to fix it.

Marc.

Craig Copeland wrote:
> The JavaScript call:
> document.getElementById("myTable").rows[0].cells.length returns 0 when TH is
> used as the initial element instead of TD.  This doesn't appear to conform 
> with
> the w3c standard, but I've been wrong before.
> (http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#edef-TD)
> Also, document.getElementById("myTable").rows[1].cells.length returns 1 for my
> example below, as does the JS above for all of the other browsers I've tested
> this example with.
> 
> Here is the error:
> BUILD FAILED
> C:\Documents and
> Settings\ccopeland\Desktop\canoo-webtest\tests\test-innerHTML.x
> ml:10: Canoo Webtest: R_1345.
> Test failed.
> Test step verifyElementText (C:\Documents and
> Settings\ccopeland\Desktop\canoo-w
> ebtest\tests\test-innerHTML.xml:23: )  named "verify the Text" failed with
> messa
> ge "Wrong contents found in HTML element (type="null", name="null",
> htmlId="tmp"
> )! Expected "NumCols = 1" but got "numCols = 0""
> 
> Here's the test case:
> ------ WebTest TestCase -------
> <?xml version="1.0"?>
> <!DOCTYPE project SYSTEM "WebTest.dtd"[
>   <!ENTITY config     SYSTEM "configForInnerHTML.xml">
> ]>
> 
> <project name="Testing 1.2.3" basedir="." default="main">
>   <property name="webtest.home" location="C:\Documents and
> Settings\ccopeland\Desktop\canoo-webtest" />
>   <import file="${webtest.home}/lib/taskdef.xml"/>
>   <target name="main">
>     <webtest name="myTest">
>       &config;
>       <steps>
>         <enableJavaScript enable="true"/>
>         <invoke
>           description="get Test Page"
>           url="test.htm" />
>         <verifyTitle
>           description="verify the Title"
>         text="Test" />
>         <verifyElementText
>           description="verify the number of columns found by the JS call"
>           htmlId="tmp"
>           text="NumCols = 1" />
>       </steps>
>     </webtest>
>   </target>
> </project>
> -------------------------------
> -------- test.htm File --------
> <HTML>
>     <HEAD>
>         <TITLE>Test</TITLE>
>         <script language="javascript" src="test.js" type="text/javascript">
>         </script>
>     </HEAD>
> <BODY>
> <P id="tmp">tmp</P>
> <TABLE id="myTable">
>   <TR><TH>Some Heading</TH></TR>
>   <TR><TD>some desc</TD></TR>
> </TABLE>
> <script type="text/javascript">
>         testIt();
> </script>
> </BODY>
> </HTML>
> -------------------------------
> -------- test.js File ---------
> function testIt() {
>   var numCols = document.getElementById("myTable").rows[0].cells.length;
>   document.getElementById("tmp").innerHTML = "numCols = " + numCols;
> }
> -------------------------------
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 


_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest

Reply via email to