CEFSharp致性JS脚本并获取返回数据
CEFSharp中需要用js脚本去获取一部分值,并进行返回
//StringBuilder sb = new StringBuilder();
//sb.AppendLine("function tempFunction() {");
////sb.AppendLine(" return document.body.innerHTML; ");
//sb.AppendLine(" return window.dmtrack_pageid; ");
//sb.AppendLine("}");
//sb.AppendLine("tempFunction();");
var task01 = e.Frame.EvaluateScriptAsync("window.dmtrack_pageid");
task01.ContinueWith(t =>
{
if (!t.IsFaulted)
{
var response = t.Result;
if (response.Success == true)
{
if (response.Result != null)
{
string resultStr = response.Result.ToString();
CookieHelper.dmtrack_pageid = resultStr;
}
}
}
}); //var task01 = e.Frame.EvaluateScriptAsync("window.dmtrack_pageid");
task01.ContinueWith(t =>
{
if (!t.IsFaulted)
{
var response = t.Result;
if (response.Success == true)
{
if (response.Result != null)
{
string resultStr = response.Result.ToString();
CookieHelper.dmtrack_pageid = resultStr;
}
}
}
});
版权声明:本文为YES开发框架网发布内容,转载请附上原文出处连接
post YES开发框架