0
首先,我應該說我需要在我的應用程序中使用Internet Explorer(IE9)對象,我無法使用webBrowser控件。所以,我想在網頁上模擬領域的焦點事件:RuntimeBinderException在IE對象
webBrowser.Document.Forms[0].GetElementsByTagName("input")[0].InvokeMember("onFocus");
webBrowser.Document.Forms[0].GetElementsByTagName("input")[0].SetAttribute("value", "aaaa");
webBrowser.Document.Forms[0].GetElementsByTagName("input")[1].InvokeMember("onFocus");
webBrowser.Document.Forms[0].GetElementsByTagName("input")[1].SetAttribute("value", "bbbbb");
web瀏覽器變量是public static SHDocVw.InternetExplorer webBrowser;
。它的值設置爲new SHDocVw.InternetExplorer();
。
當執行代碼的第一行,我得到一個異常,
"System.MarshalByRefObject.InvokeMember(<...>)" Inaccessible due to protection level.
我使用的功能private static
。也許它與IE的文檔是動態的事實有關?
那麼,我該如何解決這個異常?或者有沒有其他的方式來模擬一個領域的焦點?
在此先感謝。