C# Windows App 如何从 WebView 获取 html 源代码 [英] C# Windows App how to get html source code form WebView
本文介绍了C# Windows App 如何从 WebView 获取 html 源代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在c#中获取WebView组件的html源代码?
How to get html source code form WebView component in c#?
推荐答案
您可以使用 InvokeScript
或 InvokeScriptAsync
方法.请确保首先加载页面.
You can use the InvokeScript
or InvokeScriptAsync
methods. Do make sure the page is loaded first.
string html = await myWebView.InvokeScriptAsync("eval", new string[] { "document.documentElement.outerHTML;" });
var text = html;
这篇关于C# Windows App 如何从 WebView 获取 html 源代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文