We have used CAutomationElement class for seaching the elements on the webDocument and identified the table and different controls. Some sample code is as below:
if (parentElement != null)
{
string description = string.Empty;
switch (elementInformation.SearchBy)
{
case SearchByType.Name:
description = parentElement.Name;
break;
case SearchByType.ID:
description = parentElement.AutomationId;
break;
}
if (description != null && description.Equals(elementInformation.ElementDescription.Trim()))
{
searchedElement = parentElement;
}
else
{
List<IWebElement> children = parentElement.Children;
foreach (IWebElement childElement in children)
{
IWebElement tempElement = SearchHtmlElement(childElement, elementInfo);
if (tempElement != null)
{
searchedElement = tempElement;
break;
}
}
}