IBrowser browser = this._browser.GetBrowser();
if (browser.HasDocument)
{
IFrame mainFrame = browser.MainFrame;
var js = "var f= function A(){ return $('img',$('#"+id+"'));}; f();";
var task = mainFrame.EvaluateScriptAsync(js, null);// "(function() { var body = document.body, html = document.documentElement; return Math.max( body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight ); })();", null);
//執行腳本
//browser.MainFrame.ExecuteJavaScriptAsync("document.getElementById('testid').click();");
//browser.MainFrame.ExecuteJavaScriptAsync("document.getElementById('testid2').value='123'");
task.ContinueWith(t =>
{
if (!t.IsFaulted)
{//返回結果
var response = t.Result;
var result = response.Success ? (response.Result ? "null") : response.Message;
//html = result.ToString();
}
}, TaskScheduler.FromCurrentSynchronizationContext());
}