C# BHO遍历iframe

来源:互联网 发布:python pip yum源 编辑:程序博客网 时间:2024/06/05 08:03

因为有有项目需要BHO进行对ie浏览器中的网页解析 DOM分析会有很多转换 遇到iframe里面的数据采集不到。查了资料以下方法可行:

                IHTMLIFrameElement iframe = document.getElementById("abcFrame") as IHTMLIFrameElement;                if (iframe != null)                {                    IHTMLDocument3 docinner = (iframe as HTMLFrameElement).contentWindow.document as IHTMLDocument3;                    try                    {                        inputBox = docinner.getElementById("inputBoxName") as IHTMLInputElement;                        System.Windows.Forms.MessageBox.Show(inputBox.name);                        onConn();                    }                    catch(Exception ex)                    { System.Windows.Forms.MessageBox.Show(ex.Message); }


0 0
原创粉丝点击