参照の追加
Document使用時、参照に「Microsoft HTML Object Library」を追加する
documentの使用
IHTMLDocument doc = (IHTMLDocument)webBrowser1.Document;
IHTMLDocument2 doc2 = (IHTMLDocument2)webBrowser1.Document;
IHTMLDocument3 doc3 = (IHTMLDocument3)webBrowser1.Document;
IHTMLElement element = doc3.getElementById("key");
IHTMLElementCollection elementCollection = doc3.getElementsByTagName("INPUT");
script error スクリプトエラーを制御する
window_Loaded等に以下のコードを追加する
var axIWebBrowser2 = typeof(WebBrowser).GetProperty("AxIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic);
var comObj = axIWebBrowser2.GetValue(webBrowser1, null);
comObj.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, comObj, new object[] { true });
