DocumentText Geckofx

DocumentText Geckofx

Added by Nasir Mahmood updated on Tuesday, October 21, 2014

Problem:

WebBrowser control has a built in property called DocumentText which is used get or set html source of page. Geckofx has not such property by following code we can get page source easily.

_browser.Document.GetElementsByTagName("html")[0].InnerHtml
                

Where _browser is instance of GeckoWebBrowser

Extension Method:

Now we are going to make Extension method of above code so that we can use it every where.

public static string DocumentText(this GeckoWebBrowser browser)
{
    return browser.Document.GetElementsByTagName("html")[0].InnerHtml;
}
                

Usage:

Now it is very easy to use this method as

string source = _browser.DocumentText();
                

About

29 Tutorials
25 Snippets
6 Products

More

Contact Us

Contact us

Stay Connected