01-20-2023 01:48 PM
Hi,
I have a problem, when I am using WebView2 Control contributed by Sklein [https://www.vipm.io/package/sklein_lib_webview2/].
It is excellent integration of Edge browser into LabView, which allow us to integrate a modern browser - Microsoft Edge into our VIs.
Usually I am using this tool for web pages which are using scripting to avoid errors and to display pages inside VIs, if you are using the original LabView Get.Vi with Integarted Microsoft Explorer [https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHypCAG&l=sl-SI].
My problem:
I would like to extract a HTML code from browser to process certain data, when I am using WebView2 Control
How I tried to solve a problem:
1. I found the following idea: https://github.com/MicrosoftEdge/WebView2Feedback/issues/208
2. The idea is to call a method inside WebView2 ExecuteScriptAsync with JS function "document.body.outerHTML"
3. Example in Visual Basic:
var html = await webView2.CoreWebView2.ExecuteScriptAsync("document.body.outerHTML");
4. My VI code to extract HTML source code is following:
5. Complete source code is included [Press "GO" to display web page, press "Get HTML" to get HTML code]
Result:
Disaster - VI blocks and complete LabView suite is frozen.
Do you have any idea how to solve this problem to get HTML source code from WebView2 Control?
Regards,
Roman Flegar