question

PedroRequena-9597 avatar image
0 Votes"
PedroRequena-9597 asked PedroRequena-9597 answered

How to transform a string type variable that contains the retrieval of an HTML into an Html Document without passing it through the Webbrowser? on VB.net

I am working with querying elements from various websites and I am using Chromium from Webview and I get all the Html modified by the Javascript and I need to load that Text from the retrieved Html into an HTML Document and the way I do it is by doing this:

Public Sub Descarga_Html1()

     Dim IE_Webbrowser As New WebBrowser
     Dim Contenido_HTMl As String
     Contenido_HTMl = Form2.WebView1.GetSource.ToString

     'Dim htmldoc As HtmlDocument

     Dim Datos As String
     Datos = Contenido_HTMl

     IE_Webbrowser.ScriptErrorsSuppressed = True
     IE_Webbrowser.DocumentText = Datos
     IE_Webbrowser.Document.OpenNew(True)
     IE_Webbrowser.Document.Write(Datos)

     Espera(2000)
     Htmldoc = IE_Webbrowser.Document
     IE_Webbrowser.DocumentStream.Close()
     IE_Webbrowser.Dispose()



end sub
but doing it this way leads me to Error:

System.OutOfMemoryException

From the amount of queries and the load of the Webbrowser, for that reason I would like to have the idea of how to pass that Text that contains the HTML directly to an HTML Document, thank you very much.


vs-general
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimpleSamples avatar image
0 Votes"
SimpleSamples answered SimpleSamples edited

As best as I can tell, you are trying to use WebBrowser and WebView as if they are the same thing. They are not. You cannot use parts of WebBrowser and parts of WebView.

See WebView Class; specifically the part that says:

In apps compiled for Windows 10, WebView uses the Microsoft Edge rendering engine to display HTML content. In apps compiled for Windows 8 or Windows 8.1, WebView uses Internet Explorer 11 in document mode.

As you can see, for WebView there is no equivalent to a WebBrowser.Document property. The following describes how to get the HTML from a WebView, however they are for UWP programs. You should have used a tag for your question to indicate whether this is a UWP, WPF or Windows Forms program.

If you can be more specific about the type of application this is then I can be more specific about what to do.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

PedroRequena-9597 avatar image
0 Votes"
PedroRequena-9597 answered

It is an Application in Windows Form of desktop type I use the EO.Webview chromium in .Net (vb.net) registered in a windows form with the GETHTML property extracted all the code of the HTML transformed by the execution of the Javascript and that Html String obtained by the Gethtml is the one I need to convert into Html Document

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.