Tuesday, 15 November 2011

Get the Table Header names using watin

The following code will get Table header names.


TableRow tableRow = Browser.Table("headerTable").TableRow("headerRow");
StringCollection headerValues = new StringCollection();

foreach (Element e in tableRow.Elements)
 {
    if (e.TagName.ToUpper()=="TH")
    {
        headerValues.Add(e.Text);
     }
 }

Thanks,
Md. Jawed