本文介绍了如何使用cefsharp在变量中检索和存储渲染的HTML源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在Windows窗体应用程序中使用CefSharp库来呈现HTML。最初我使用的是Web浏览器控件但有时会在少量URL上产生问题。



现在我想检索完整的HTML源并存储在字符串变量中以进一步处理。



以前有人这样做过吗?请帮帮我。



我尝试了什么:



试过了它的例子但没有得到确切的解决方案。

Hi,
I am using CefSharp library to in Windows Form application to render HTML. Initially i was using Web Browser control but sometimes it creates problem on few URL.

Now i want to retrieve the full HTML source and store in a string variable to process further.

Is anyone has done this before? Please help me.

What I have tried:

Tried the example of it but not get the exact solution.

推荐答案

webView.EvaluateScript(@"document.getElementsByTagName ('html')[0].innerHTML").ToString();



还有一个 GetSourceAsync()方法可能有所帮助。

[]



希望,它有帮助:)


There is also a GetSourceAsync() method which may help.
CefSharp/IWebBrowser.cs at cefsharp/41 · cefsharp/CefSharp · GitHub[^]

Hope, it helps :)


这篇关于如何使用cefsharp在变量中检索和存储渲染的HTML源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 01:54