I've found the XPather Firefox add-on to be helpful in this regard, fwiw.

Jevon Wright wrote:
Hi Lakshmi,

You could try getElementsByXPath("//table/tr[0]/th[contains(text(), 'Attempts'])") or something similar. There's no straightforward way to do what you're asking, but using a series of XPath expressions I think you should be able to manage that.

Perhaps something like

1. Get the index # of "Attempts" in "/table/tr[0]/th"
2. Use this to access all td's with that #, e.g. "/table/tr/td[$i]"

My XPath is a little rusty so these queries probably don't work :-)

Cheers
Jevon

On Thu, Feb 25, 2010 at 8:38 AM, lakshmi somavaram <lsomava...@gmail.com <mailto:lsomava...@gmail.com>> wrote:

    Hi Jwebunit Users,
The following is the HTML table code. Is there a way to count the
    number of rows, or get the data  in the table using JWebUnit?
Here the table *does not have the table id or name* associated
    with it. Without changing the HTML code, I want to be able to get
    the value of the column with the heading "Attempts" in this table.
Also, there are some more tables in this page that have no names
    and id's.
    Please direct me in the right direction.
Thank you,
    Lakshmi

    <table>
           <tr>
               <th class="columnheader">Type</th>
    <th class="columnheader">Attempts</th>
    <th class="columnheader">Initial Failure Date</th>
    <th class="columnheader">Office</th>
    <th class="columnheader">Cust Name</th>
    <th class="columnheader">Recv Id</th>

            </tr>
<tr class="oddRow">
                            <td class="tablerow">Notification</td>
                            <td class="tablerow">1</td>
                            <td class="tablerow">02/24/2010</td>
                            <td class="tablerow">FSA KANSAS CITY
    COMPLEX-FSA</td>
                            <td class="tablerow">AQUA-GULF TRANSPORT
    INC</td>
                            <td class="tablerow">554474</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td><th class="columnheader"
    colspan="6">Reasons</th>
                        </tr>
<tr><td>&nbsp;</td><td
    class="tablerow" colspan="7">Received null office for state and
    county</td></tr>
<tr class="evenRow">
                            <td class="tablerow">Notification</td>
                            <td class="tablerow">2</td>
                            <td class="tablerow">02/23/2010</td>
                            <td class="tablerow">FSA KANSAS CITY
    COMPLEX-FSA</td>
                            <td class="tablerow">INTERFREIGHT
    TRANSPORT SYSTEMS</td>
                            <td class="tablerow">547681</td>
                        </tr>
                        <tr>
                            <td>&nbsp;</td><th class="columnheader"
    colspan="6">Reasons</th>
                        </tr>
<tr><td>&nbsp;</td><td
    class="tablerow" colspan="7">Received null office for state and
    county</td></tr>
<tr class="oddRow">
                            <td class="tablerow">Notification</td>
                            <td class="tablerow">3</td>
                            <td class="tablerow">02/23/2010</td>
                            <td class="tablerow">FSA KANSAS CITY
    COMPLEX-FSA</td>
                            <td class="tablerow">WETERN AG RESOURCES</td>
                            <td class="tablerow">547577</td>
                        </tr>
    <tr><td colspan="5">&nbsp;</td></tr>
        </table>
    
------------------------------------------------------------------------------
    Download Intel&#174; Parallel Studio Eval
    Try the new software tools for yourself. Speed compiling, find bugs
    proactively, and fine-tune applications for parallel performance.
    See why Intel Parallel Studio got high marks during beta.
    http://p.sf.net/sfu/intel-sw-dev
    _______________________________________________
    JWebUnit-users mailing list
    JWebUnit-users@lists.sourceforge.net
    <mailto:JWebUnit-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/jwebunit-users


------------------------------------------------------------------------

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
------------------------------------------------------------------------

_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to