質問

私たちは、asp.netで開発されたWebアプリケーションを自動化したいです。このサイトを自動化するために、我々は、MSHTMLを使用することを計画しています。しかし、MSHTMLを最終決定する前に、私はMSHTMLのいずれかの既知の制限がある場合は知っているか、我々はMSHTMLを使用して自動化することができないかもしれないコントロールのリストを共有してくださいしたいと思います。

MSHTMLの自動化とあなたの経験を共有してください。おかげます。

役に立ちましたか?

解決

私たちはwebDocument上の要素をseachingためCAutomationElementクラスを使用して、テーブルとさまざまなコントロールを同定しました。いくつかのサンプルコードは以下の通りです。

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;
        }
        }
    }
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top