'How to convert a WebView2 to HtmlDocument?
I want to convert my old webBrowser API to the new webView2 API.
HtmlDocument doc = webBrowser.Document.OpenNew(false);
doc.Write(sResponse);
var resultAsString = (string)doc.InvokeScript("eval", new object[] { "window.validate" });
How can I do it?
Solution 1:[1]
The answer is to use NavigateToString and ExecuteScriptAsync
webBrowser.NavigateToString(sResponse);
var scriptResult = await webBrowser.ExecuteScriptAsync("window.validate");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Erez Fridman |
