DocumentText Geckofx

DocumentText Geckofx

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


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.


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;


Now it is very easy to use this method as

string source = _browser.DocumentText();


32 Tutorials
27 Snippets
6 Products


Contact Us

Contact us

Stay Connected