23 Aralık 2015 Çarşamba

c# webbrowser işlemleri

webBrowser1.Document.GetElementById("textboxın adı").InnerText = textBox1.Text;
foreach (HtmlElement el in webBrowser1.Document.All)
{
if (el.Name == "buton ismi")
{
el.InvokeMember("click");
}
}
ya da;




?
1
2
3
webBrowser1.Document.GetElementById("email").InnerText = epostaAdresi;
webBrowser1.Document.GetElementById("pass").InnerText = sifre;
webBrowser1.Document.Forms[0].InvokeMember("submit");

textBox1.Text = WebBrowser1.document.GetElementsByTagName("h3")[0].InnerText;


2
down vote
accepted
If you use System.Windows.Controls.WebBrowser control then this should work, however it works on assumption that you only have one CODE tag:
var myTagValue = (wbBrowser.Document as mshtml.HTMLDocument)
                   .getElementsByTagName("CODE")
                   .OfType<mshtml.IHTMLElement>()
                   .First()
                   .innerText


HtmlAgilityPack.HtmlDocument HTMLDocument = new HtmlAgilityPack.HtmlDocument();
            HTMLDocument.LoadHtml(HTML);
            HtmlNodeCollection ImageNodes = HTMLDocument.DocumentNode.SelectNodes("//img");
            foreach (HtmlNode Node in ImageNodes)
            {
                MessageBox.Show(Node.Attributes["SRC"].Value);
                Node.Attributes["SRC"].Value  = "NewSource";
            }
            MessageBox.Show(HTMLDocument.DocumentNode.InnerHtml);




   foreach (HtmlElement  htmlobj in  wb.Document.All)
        {
            if (htmlobj.TagName =="TABLE")
                foreach (HtmlElement htmlTableTD in htmlobj.Document.All)
                {
                    if (htmlTableTD.TagName == "TD")
                        MessageBox.Show(htmlTableTD.OuterText);
                    break;
                }
            break;
        }