C#WPFプログラムで、次のようText
に定義されたHTML要素の値を設定しようとしています。
<input name="tbBName" type="text" id="tbBName" tabindex="1" />
私は次のことを試しました:
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)webBrowser1.Document;
mshtml.HTMLInputTextElement tbName = (mshtml.HTMLInputTextElement)doc.getElementsByName("tbBName");
tbName.value = "Test";
しかし、次の例外が発生します。
Unable to cast COM object of type 'System.__ComObject' to interface type 'mshtml.HTMLInputTextElement'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{3050F520-98B5-11CF-BB82-00AA00BDCE0B}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
それが何を言っているかは知っていますが、テキストボックスにアクセスするためにどのオブジェクトを使用できるかわかりません。
私は何が間違っているのですか?