using(var wb = new WebBrowser()) { wb.ScriptErrorsSuppressed = true; wb.Navigate("about:blank"); var startTime = DateTime.Now; while (true) { Application.DoEvents(); if (wb.ReadyState == WebBrowserReadyState.Loaded || wb.ReadyState == WebBrowserReadyState.Complete || startTime.AddMilliseconds(1) < DateTime.Now) break; } wb.Document.Body.InnerHtml = "<h1>Hello</h1>"; var x = wb.Document.Body.Children[0].OuterHtml ; }
标签:Body,ReadyState,wb,c#,DateTime,html,webbrowser,var,Document From: https://www.cnblogs.com/nanfei/p/17032130.html