Exemplo n.º 1
0
        public static WatiN_IE show_Formated_Javascript(this WatiN_IE ie, WatiN_IE temp_ie, string codeToFormat)
        {
            var prettifyHtml = @"prettify.htm".local();

            if (prettifyHtml.fileExists().isFalse())
            {
                return(ie);
            }

            if (ie.url().isNull() || ie.url().contains("prettify.htm").isFalse())
            {
                ie.open(prettifyHtml);
            }
            var formatedJsCode = (temp_ie.isNull())
                                     ? ie.HostControl.formatJsCode(codeToFormat)
                                     : temp_ie.formatJsCode(codeToFormat);

            var codeDiv = ie.div("codeDiv");

            codeDiv.innerHtml("<pre id=\"code\" class=\"prettyprint\">{0}</pre>".format(formatedJsCode));
            ie.invokeScript("prettyPrint");
            return(ie);
        }