Since DotNetBrowser 1.9 it is possible to specify custom CSS rules, which will be then applied to every page loaded in the Browser instance.

You can configure custom CSS by setting the Browser.CustomStylesheet property. The CSS rules will be applied to the next page loaded in the Browser.

To reset the custom CSS to defaults, you can set the Browser.CustomStylesheet property to an empty string.


The following sample code demonstrates how to remove scrollbars for the HTML and BODY elements:

string hideOverflowCss = "HTML, BODY {overflow:hidden;}";
browser.CustomStylesheet = hideOverflowCss;

Note: the CSS rules specified by the particular page will not be overriden.