Offscreenブラウザを使用しました。次に、htmlを作成しwebView、サブスクライブしてロードしました。DocumentReady
_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 を使用しました。
お願い助けて :(