我试图使用.NET 4中的WinForms使用OpenWebKitSharp来调用javascript
这是我试图使用的代码.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WebKit;
using WebKit.Interop;
using WebKit.JSCore;
using webkitForm.Properties;
namespace webkitForm
{
public partial class Form1 : Form
{
WebKitBrowser webKitSharpBrowser = new WebKitBrowser();
public Form1()
{
InitializeComponent();
this.Controls.Add(webKitSharpBrowser);
webKitSharpBrowser.Width = 600;
webKitSharpBrowser.Height = 400;
}
private void button1_Click(object sender, EventArgs e)
{
webKitSharpBrowser.Preferences.AllowPlugins = true;
webKitSharpBrowser.UseJavaScript = true;
webKitSharpBrowser.Navigate("http://sandbox.icontact.com");
webKitSharpBrowser.GetScriptManager.EvaluateScript("alert('An alert from C#!');"); //Call javascript?
}
}
}
Run Code Online (Sandbox Code Playgroud)
我无法获取任何东西的javascript ...必须有一些我缺少的东西.
提前致谢.
我试图在我的应用程序中使用OpenWebKitSharp作为浏览器.我设法让它工作,但我找不到通过点击一次来勉强的方法.当我将文件从库的Core目录放到我的调试目录应用程序时,但这些文件不是通过clickonce部署的.如果我试图将它们包含在项目中 - 错误Could not find file 'WebKit.dll'.
有人做过吗?或者可能使用不同的体面库而不是OpenWebKitSharp?