views:

307

answers:

1

We want to automate a web application which is developed in asp.net. For automating this site we are planning to use the MSHTML. But before finalizing MSHTML I would like to know if there are any known limitations of MSHTML or please share list of controls which we may not be able to automate using MSHTML.

Please share your experiences with MSHTML automation. Thanks.

A: 

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;
        }
        }
    }
NewAutoUser