C#CEFSHARP RENDERPROCESSMESSAGEHANDLER示例
我是 C# 新手,正在学习 Cefsharp + javascript。我试图等到页面使用 Cefsharp 完成加载后再执行我的代码。我找到下面的代码片段,并将其添加到一个新类中,在该类中出现关于创建接口的错误,请帮助在这些接口中需要编写什么?
public class RenderProcessMessageHandler : IRenderProcessMessageHandler
{
// Wait for the underlying `Javascript Context` to be created, this is only called for the main frame.
// If the page has no javascript, no context will be created.
void IRenderProcessMessageHandler.OnContextCreated(IWebBrowser browserControl, IBrowser browser, IFrame frame)
{
const string script = "document.addEventListener('DOMContentLoaded', function(){ alert('DomLoaded'); });";
frame.ExecuteJavaScriptAsync(script);
}
}
I am a novice at C# and learning Cefsharp + javascript. I'm attempting to wait until the page has finished loading with Cefsharp to execute my code. I found code snippet below, and added that to a new class, in the class occurs errors about to creating interfaces, please help what need to write inside these interfaces?
public class RenderProcessMessageHandler : IRenderProcessMessageHandler
{
// Wait for the underlying `Javascript Context` to be created, this is only called for the main frame.
// If the page has no javascript, no context will be created.
void IRenderProcessMessageHandler.OnContextCreated(IWebBrowser browserControl, IBrowser browser, IFrame frame)
{
const string script = "document.addEventListener('DOMContentLoaded', function(){ alert('DomLoaded'); });";
frame.ExecuteJavaScriptAsync(script);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在接口
irenderProcessMessageHandler
中实现所有方法“ rel =“ nofollow noreferrer”> this 供参考
You need to implement all methods in the interface
IRenderProcessMessageHandler
You can check this out for the reference