I tried to get the index of column (or row) table by name but I'm using selenium WebElement
to capture interface of table or column, row,.... and I can't store captured table to DataTable
(in System.Data.dll reference). I read in get index of DataTable column with name but I cannot store data in column of table to DataColumn
and get it by using DataColumn.Ordinal
. Here is my interface:
IWebElement Table = driver.FindElement(By.XPath("//*[@class='DivTable']//table"));
ReadOnlyCollection<IWebElement> allRows = Table.FindElements(By.TagName("tr"));
foreach(IWebElement row in allRows)
{
ReadOnlyCollection<IWebElement> allCols = row.FindElements(By.TagName("td"));
foreach (IWebElement col in allCols)
{
//do something
}
}