Results 1 to 4 of 4

Thread: How to get text from webbrowser to vb.net <span> HELP!

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    9

    Unhappy How to get text from webbrowser to vb.net <span> HELP!

    Hi Forum

    I'm new here and i thanks in advance who would help me fix this.
    Tryed lot of things and i still have problem.

    So let me explain

    I want to store 3 Values from Webbrowser that are in <span> to vb.net label

    Here is HTML ( of 3 Values i need )

    HTML Code:
    <li class="_bnq48">
    <span class="_t98z6">
    <!-- react-text: 27 -->
    <!-- /react-text -->
    <span class="_fd86t">11</span>
    <!-- react-text: 29 --> posts<!-- /react-text -->
    </span>
    </li>
    
    
    
    
    <li class="_bnq48">
    <a class="_t98z6" href="/gembowa/reactions/">
    <!-- react-text: 32 -->
    <!-- /react-text -->
    <span class="_fd86t" title="772">772</span>
    <!-- react-text: 34 --> reactions<!-- /react-text -->
    </a>
    </li>
    
    
    
    <li class="_bnq48">
    <a class="_t98z6" href="/gembowa/Coins/">
    <!-- react-text: 37 -->
    <!-- /react-text -->
    <span class="_fd86t">264</span>
    <!-- react-text: 39 --> Coins<!-- /react-text -->
    </a>
    </li>
    I need these Values 11, 772, 264 storred to vb.net labels

    I tryed following with 1 loop because all classes are same. ( NOT WORKING ):

    Code:
     For Each h As HtmlElement In WebBrowser1.Document.GetElementsByTagName("span")
                    If Not Object.ReferenceEquals(h.GetAttribute("className"), Nothing) AndAlso h.GetAttribute("className").Equals("_fd86t") Then
                        Label1.Text = h.InnerText
                        Exit For
                    End If
                Next
    Is there way to copy these values with .InnerHtml.Contains or .Contains and get thought "text": posts, reactions, coins ?

    Thank you all,

    Great forum.

  2. #2

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    9

    Re: How to get text from webbrowser to vb.net <span> HELP!

    Sorry for my bad english.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    9

    Re: How to get text from webbrowser to vb.net <span> HELP!

    Anyone could help, Thanks?

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2017
    Posts
    9

    Re: How to get text from webbrowser to vb.net <span> HELP!

    Resolved.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width