我用webbrowser获取网页内容时,如果网页存在框架,怎么获取框架里的内容.网上说:webbrowser.document.framers 但是我的怎么点不出来这个 .framers

解决方案 »

  1.   

    this.webBrowser1.Document.Window.Frames
      

  2.   

    webBrowser1.Document.Window.Frames
    webBrowser1.Document.Forms
      

  3.   

     HtmlElement title = webMain.Document.Window.Frames["content3"].Document.GetElementById("topic");
    怎么这样些好象还是得不到 <iframe src="about:blank"  name="content3" id="content3" frameborder="0" scrolling="no"></iframe>
    里面的值啊. iframe 下有 <input name="topic" id="topic" size="40" maxlength="50" value="" type="text">这个的.
     
      

  4.   

    看这篇文章:C#用WebBrowser控件获取Post数据
      

  5.   

    我是要用webbrowser 获取iframe下的一个input 的控件吗.
      

  6.   

    你的<iframe src="about:blank"  name="content3" id="content3" frameborder="0" scrolling="no"> </iframe> 
    src怎么是about:blank啊?
      

  7.   

    他的src应该是点吉的时候传过去的吧,这个有关系吗?<a href="user_post.asp" onClick="go_cmdurl('发布日志',this);border_left('TabPage2','left_tab2');" title="发表" target="content3"> 这个是点击的.
      

  8.   

    如果iframe中包含的网页中有那个按钮的话,你可以这样webBrowser1.Document.Window.Frames["content3"].Document.GetElementById("topic")
      

  9.   

    那你必须等那个iframe把网页加载了你才可以调用上面的方法
      

  10.   

    http://blog.tajyw.com/ 注册个blog
      

  11.   

    webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
            {
                if (e.Url.ToString().Contains("user_post.asp"))
                {
                    webBrowser1.Document.Window.Frames["content3"].Document.GetElementById("topic").SetAttribute("value", "123456");
                }
    这样写 我试过的
      

  12.   

    真的可以吗,为什么我每次都 找不到 topic 啊.
      

  13.   

    汗,原来问题在这,我一直用的是 webbrowser.Url.PathAndQuery 判断的,谢谢兄弟了,总算找到问题所在了.