Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6130959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:55:08+00:00 2026-05-23T16:55:08+00:00

Consider this HTML table: <table id=build-table> <tr> <th>Build ID</th> <th>Build Time</th> </tr> <tr> <td>

  • 0

Consider this HTML table:

<table id="build-table">
    <tr>
        <th>Build ID</th>
        <th>Build Time</th>
    </tr>

    <tr>
       <td>
            <a href="/Details/5.1">5.1</a>
        </td>
        <td>02.06.2011 13:33:03</td>
    </tr>
</table>

How would I verify in WatiN that the table has the correct headers (Build ID and Build Time), and the correct content (in this case, one row containing the given hyperlink and date string)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:55:08+00:00Added an answer on May 23, 2026 at 4:55 pm

    Sorry, we created a custom TableHandler, using the basic table building blocks: Here is the sample code:

    public TableController(Regex tableControlId)
    { InitializeMembers(Find.ById(tableControlId), true); }
    
    private void InitializeMembers(WatiN.Core.Constraints.AttributeConstraint tableControlId, bool hasColumnHeaders)
    {
        if (tableControlId == null)
        {
            throw new ArgumentNullException("tableControlId", "'tableControlId' passed in should not be null.");
        }
    
        WatiN.Core.Constraints.AttributeConstraint newTableControlId = tableControlId;
        Assert.IsTrue(IE.Table(newTableControlId).Exists, "Table with id '" + newTableControlId.ToString() + "' does not exist on this page.");
        _controlId = tableControlId;
        _hasColumnHeaders = hasColumnHeaders;
    
        _columnHeaders = (hasColumnHeaders) ? GetTableColumnHeaders() : null;
        _totalRows = Table.TableRows.Count;
        _totalColumns = GetAllColumnDataFromRow((TableRow)Table.TableRows[0], hasColumnHeaders).Count;
    }
    
    private StringCollection GetTableColumnHeaders()
    {
        return GetAllColumnDataFromRow((TableRow)Table.TableRows[0], true);
    }
    
    
    private StringCollection GetAllColumnDataFromRow(TableRow tableRow, bool isTableHeaderRow)
    {
        StringCollection RowValues = new StringCollection();
        if (tableRow == null)
        {
            for (int colCounter = 0; colCounter < this.TotalColumns; colCounter++) RowValues.Add(String.Empty);
        }
    
        if (isTableHeaderRow)
        {
            foreach (Element e in tableRow.Elements)
            {
                if (e.TagName == "TH")
                {
                     RowValues.Add(e.Text);
                }
             }
        }
        else
        {
            foreach (TableCell tc in tableRow.TableCells)
            {
                if (String.IsNullOrEmpty(tc.Text))
                {
                    RowValues.Add(String.Empty);
                }
                else
                {
                    RowValues.Add(tc.Text);
                }
            }
         }
        //fill up for the missing cells, if any, with blanks
        int actualCellsInRow = tableRow.TableCells.Count;
        int expectedCellsInRow = this.TotalColumns;
        for (int colCounter = actualCellsInRow; colCounter < expectedCellsInRow; colCounter++)
        {
            RowValues.Add(String.Empty);
        }
    
        return RowValues;
    }
    

    Hope this helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this HTML: <form id=MyForm> <input name=Input1/> </form> To get the form, I would
Consider this code : HTML: <table> <tr> <td>Option 1</td> <td><input type='checkbox' id='option1' /></td> </tr>
Consider this page @ http://www.bloodbone.ws/screwed.html I need to be able to have the a.grow
This problem is only in IE. Consider the following HTML: <html> <body> <div style='position:absolute;left:1em;right:1em;top:1em;bottom:1em;overflow:auto;>
Consider this example table (assuming SQL Server 2005): create table product_bill_of_materials ( parent_product_id int
Consider simple XML document: <html><body> <table> <tr><td> Item 1</td></tr> <tr><td> Item 2</td></tr> </table> </body></html>
Please consider the following HTML: <td> Some Text <table>.....</table> </td> I need to manipulate
Consider this example showing the YUI tree in action: http://developer.yahoo.com/yui/examples/treeview/tv_edit.html Select the title in
Consider this (snipped) example <!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd> <html xmlns=http://www.w3.org/1999/xhtml>>
Consider an automated build system that stores results in a database and offers tabular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.