Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
//获得天气预报获得observe24h_data变量
//与下面方法结果相同,HtmlAgilityPack解析。
var task1 = control.Browser.GetSourceAsync();
task1.Wait();
var htmlSource = task1.Result;
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(htmlSource);
var a = doc.DocumentNode.SelectSingleNode("//script[contains(text(), 'observe24h_data')]").InnerHtml.Split(';')[0];
//浏览器交互
var task = control.Browser.EvaluateScriptAsync(@"observe24h_data");
task.Wait();