Awesomium 1.7.5 webView.ExecuteJavascript 不工作

Awesomium 1.7.5 webView.ExecuteJavascript not work

我使用了 Offscreen 浏览器。然后,我创建了 webView,订阅了 DocumentReady 并加载了 html.

_originalWebView = WebCore.CreateWebView(this.ViewWidth, this.ViewHeight, WebViewType.Offscreen);
_originalWebView.DocumentReady += browser_DocumentReady;
_originalWebView.LoadHTML(html);

我的 DocumentReady 方法:

private void browser_DocumentReady(object sender, DocumentReadyEventArgs e)
{
    var webView = sender as WebView;
    if (webView == null)
        return;

    if (e.ReadyState == DocumentReadyState.Ready)
        return;

    var global = e.Environment;

    if (!global)
        return;

    webView.ExecuteJavascript(@"
    document.getElementById('id').innerHTML = 'Hello World' ;
");
    Thread.Sleep(2000);
    if (webView.GetLastError() != Error.None)
        System.Diagnostics.Debug.Print("There was an error calling this synchronous method");

    Html = _originalWebView.HTML;
    webView.Dispose();
}

我的html:

<html>
      <head>
        <title>Example</title>
        <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'>
      </head>
      <body>
        <div id='id'>old value</div>
      </body>
</html>

而这个 javascript 没有用。我做错了什么? 仅当 js 在 html 中时,我才能执行 js。我用的是 Awesomium 1.7.5。
请帮助我:(

更换后问题解决了

Html = _originalWebView.HTML; 

Html = webView.ExecuteJavascriptWithResult("document.getElementsByTagName('html')[0].innerHTML");
private void WebViewOnDocumentReady(object sender, DocumentReadyEventArgs e)
{
    var webView = sender as WebControl;
    webView.ExecuteJavascript(@"document.getElementById('id').innerHTML = 'Hello World';");
}