Answer the question
In order to leave comments, you need to log in
How to properly execute JS in CEFSharp?
For work I use CEFSharp. Much has been implemented and is working successfully. There is only one moment left, which I can’t win in any way, because. on the local machine it is not possible to check the site.
I wait for the page to fully load, then I execute the script. There can be 3-10 such pages - each in its own tab.
I found this method: private void WebBrowserFrameLoadEnded(object sender, FrameLoadEndEventArgs e), implemented it for myself like this:
private void WebBrowserFrameLoadEnded(object sender, FrameLoadEndEventArgs e)
{
if (e.Frame.IsMain)
{
if (AddressBar.Text.Contains("ya")) //проверка на адрес
{
WebBrowser.ExecuteScriptAsync("document.querySelectorAll('#checkbox_panel > span').forEach(function(i){ i.click()})" + ";");
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question