How to use Aspose.Html to operate a web page

Hi,Support:
I hope to get your help to use Aspose.Html API to operate a web page at a given url based on VB.net.
For example:
------------Codes------------------------------
Dim Html as aspose.html.HTMLDocument
Question 1: how to use Html object to download a file from a given url like “http://www.ycbat.com.cn/downs/APIs.txt”, please show me a full demo based on VB.net.

Question 2: how to open a given url and then search one or more html-elements such as div,a,hfre,input,button,span,file,label,frame,form …,and then get/set the value or text for the element, and perform click action fort the element.
-----------------End Code--------------------------
Thanks for your help.

@ducaisoft

We need to investigate whether your requirements are possible to achieve using Aspose.HTML for .NET or not. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): HTMLNET-4767

Please be patient and spare us some time. We are sorry for the inconvenience.

@ducaisoft

“Question 1: how to use Html object to download a file from a given url like “http://www.ycbat.com.cn/downs/APIs.txt”, please show me a full demo based on VB.net.”

In order to download a page located at a specific URL with all related resources, you can use the following code snippet:

Using document As New HTMLDocument("https://example.com/")
    document.Save("out.html")
End Using

You can download a specific file like this:

Using document As New HTMLDocument()
    Using response = document.Context.Network.Send(New RequestMessage("http://www.ycbat.com.cn/downs/APIs.txt"))
        Dim result = response.Content.ReadAsString()
    End Using
End Using

“Question 2: how to open a given url and then search one or more html-elements such as div,a,hfre,input,button,span,file,label,frame,form …,and then get/set the value or text for the element, and perform click action fort the element.”

In order to open a document located at a specific URL, you can simply create an instance of the HTMLDocument class using the URL-input constructor, as shown in the following example:

Using document As New HTMLDocument("https://example.com/")
    ' Do some work here
End Using

To find a specific element or elements in a document, you can use the following methods:

GetElementById
GetElementsByTagName
GetElementsByClassName

The following example shows how to find the “div” element in the tree, get its content, and then change it:

Using document As New HTMLDocument("<div>123</div>", String.Empty)
    Dim element = document.GetElementsByTagName("div").First()
    Dim oldText = element.TextContent
    element.TextContent = "new content"
    Dim newText = element.TextContent
End Using

In order to “click” on an element, you will need to create and send the corresponding event. The following example shows a document in which a “click” occurs on the “body” element, after which the corresponding script is triggered to change its content:

Using document As New HTMLDocument("
<script>
  function click() {
    document.body.innerHTML = 'new content';
  }
</script>
<body onclick='click()'>
123
</body>", String.Empty)
    Dim mouseEvent = document.CreateEvent("MOUSEEVENT")
    mouseEvent.InitEvent("click", False, True)
    Dim oldText = document.Body.TextContent
    document.Body.DispatchEvent(mouseEvent)
    Dim newText = document.Body.TextContent
End Using