62,271
社区成员
发帖
与我相关
我的任务
分享
HTMLDocument doc = (HTMLDocument)webBrowser1.Document.DomDocument;
object index = 1;
IHTMLWindow2 frame1 = (IHTMLWindow2)doc.frames.item(ref index);
HTMLDocument doc1 = (HTMLDocument)frame1.document;
IHTMLElement title_txt = (IHTMLElement)doc1.getElementById("kw");
//IHTMLElement body_txt = (IHTMLElement)doc1.getElementById("su");
IHTMLElement button_tj = (IHTMLElement)doc1.getElementById("su");
//if (title_txt == null || button_tj == null)
// return;
title_txt.setAttribute("value", this.textBox1.Text, 0);
//body_txt.setAttribute("value", this.richTextBox1.Text, 0);
button_tj.click();
string b = textBox3.Text;
HTMLDocument doc = (HTMLDocument)webBrowser1.Document.DomDocument;
object index = b;
IHTMLWindow2 frame1 = (IHTMLWindow2)doc.frames.item(ref index);
HTMLDocument doc1 = (HTMLDocument)frame1.document;
textBox4.Text = doc1.body.innerHTML;
string url = textBox2.Text;
webBrowser1.Url = new System.Uri(url, System.UriKind.Absolute);
Uri uri = new System.Uri(url, System.UriKind.Absolute);
//Uri uri = new System.Uri(url, System.UriKind.Absolute);
HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);
string html = sr.ReadToEnd();//此处是源码
sr.Close();
textBox4.Text = html;