if (!Cef.IsInitialized)
{
var settings = new CefSettings();
settings.CachePath = Application.StartupPath + "\\cache";// 缓存目录
settings.LogSeverity = LogSeverity.Disable;// 日志
settings.CefCommandLineArgs.Add("--disable-web-security", "");// 设置可以跨域,不同源策略
Cef.Initialize(settings);
}
// 执行js
var t = browser.GetBrowser().MainFrame.EvaluateScriptAsync("getImage()");
t.Wait();
if (t.Result != null && t.Result.Result != null)
{
str_img = t.Result.Result.ToString();
}
记录一下自己的操作 版本:cefsharp 85