Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 how to extarct inner html href of selected text in web browser control

$
0
0
Hi

I am willing to extract Inner html,inner text & href of selected text form webbrowser control I tried follow but its giving innertext & inner html for complete web page and not for the text I selected

for example my html page contain following

Code:

<p>The same approach is used in the <a href="http://sports.in.msn.com/">Read More</a></p>
I wish that If i select this text and click on gethtml button on winform then I will get inner html ,inner text of above html link but currently I am getting it for complete document, I know that its because of

Code:

  Private Sub getHTML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles getHTML.Click

          Dim htmtext = WebBrowser1.Document.ActiveElement.InnerText
        intext.Text = htmtext
        htmtext = WebBrowser1.Document.ActiveElement.InnerHtml
        inhtml.Text = htmtext
      htmtext = WebBrowser1.Document.ActiveElement.GetAttribute("href")
      href.Text = htmtext
    End Sub


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>