首页 文章

WinForms中的CefSharp - ExecuteScriptAsync或EvaluateScriptAsync不起作用

提问于
浏览
2

我在我的项目中使用CefSharp WinForms并且我无法从CefSharp浏览器控件执行JS脚本(我当时导航到URL - 因此大部分CEF功能都有效)我尝试按照以下教程进行操作:https://github.com/cefsharp/CefSharp/search?utf8=%E2%9C%93&q=BoundObject

我使用以下命名空间:

using CefSharp.WinForms;
using CefSharp.Internals;

并添加了对以下程序集的引用(x64):

CefSharp.WinForms.dll
CefSharp.dll
CefSharp.Core.dll

但是当我尝试使用其中一个函数时,我仍然收到以下错误:ExecuteScriptAsync或EvaluateScriptAsync

我收到以下错误:

'CefSharp.WinForms.ChromiumWebBrowser' does not contain a definition for 'EvaluateScriptAsync' and no extension method 'EvaluateScriptAsync' accepting a first argument of type 'CefSharp.WinForms.ChromiumWebBrowser' could be found (are you missing a using directive or an assembly reference?)

'CefSharp.WinForms.ChromiumWebBrowser' does not contain a definition for 'ExecuteScriptAsync' and no extension method 'ExecuteScriptAsync' accepting a first argument of type 'CefSharp.WinForms.ChromiumWebBrowser' could be found (are you missing a using directive or an assembly reference?)

任何人都可以指引我到我错过的地步吗?还有其他API吗?也许是我遗失的一些参考dll?谢谢

1 回答

  • 1

    您可能缺少一个其他命名空间 . 我建议你补充一下:

    using CefSharp;
    

    我们遇到了同样的麻烦,发现我们只是错过了这个 . 我们现在有:

    using System.Text;
    using CefSharp;
    using CefSharp.WinForms;
    using CefSharp.Internals;
    

相关问题