2015-11-25 53 views
2

我在我的項目中使用CefSharp WinForms,我無法讓它從CefSharp瀏覽器控件執行JS腳本 (我想導航到URL--儘管如此 - 大多數CEF功能性作品) 我想在下面的教程:我使用下面的命名空間https://github.com/cefsharp/CefSharp/search?utf8=%E2%9C%93&q=BoundObjectWinForms中的CefSharp - ExecuteScriptAsync或EvaluateScriptAsync不起作用

using CefSharp.WinForms; 
using CefSharp.Internals; 

,並添加以下組件(64引用):

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

您是否安裝了'Nuget'軟件包?你正在使用哪個版本?在較新的版本中,這些方法被製作爲「擴展方法」,因爲它們可以在特定的框架上執行。在一些情況下,我看到有人遇到麻煩。嘗試首先獲得主框架。例如https://github.com/cefsharp/CefSharp/blob/cefsharp/45/CefSharp/WebBrowserExtensions.cs#L245 – amaitland

回答

1

您可能會缺少一個其他名稱空間。我建議你添加:

using CefSharp; 

我們有同樣的煩惱,並發現我們只是缺這一個。 我們現在有:

using System.Text; 
using CefSharp; 
using CefSharp.WinForms; 
using CefSharp.Internals; 
相關問題