[英]Error executing script in c# using CefSharp
I try to use the next我尝试使用下一个
chromeBrowser.ExecuteScriptAsync("$('#user').setAttribute('value', 'usuario');");
I received the message:我收到消息:
Uncaught ReferenceError: $ is not defined
未捕获的 ReferenceError: $ 未定义
When I use the console browser of Chrome it's successfully executed.当我使用 Chrome 的控制台浏览器时,它已成功执行。
You should execute your scripts after your dependencies has been loaded.您应该在加载依赖项后执行脚本。 On
browser.LoadingStateChanged
event, probably would be the best place for that.在
browser.LoadingStateChanged
事件上,可能是最好的地方。
Look at https://github.com/cefsharp/CefSharp/wiki/General-Usage#when-can-i-start-executing-javascript for more information.查看https://github.com/cefsharp/CefSharp/wiki/General-Usage#when-can-i-start-executing-javascript了解更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.