Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

Hey guys ! This is on what I'm working on :

 Dim url As String = "http://brayket.byethost9.com/index.php?/shoutbox/"
    Dim web As New HtmlWeb()
    Dim doc As HtmlDocument = web.Load(url)
    Dim names As HtmlNodeCollection = doc.DocumentNode.SelectNodes("//span[@class='shoutbox_text']")
    Console.WriteLine(names)
    System.Threading.Thread.Sleep(100000000)

I'd like to write on the console everything that's between "<span class="shoutbox_text">" and </span> Hope I'll find some help here :)

share|improve this question
    
Have you tried Console.WriteLine(names.InnerText)? –  Marcus Rickert Apr 24 at 21:20
    
@MarcusRickert I don't have the possibility I know that it works because if I do console.writeline(names.count) it shows the right amount of span class"shoutbox_text" in the html code. But I can't manage to show what are these classes >< (By the way, I'm using HtmlAglityPack) –  Niiw Apr 24 at 22:30
    
I've managed to make it work ! This is what I've done : codeDim web As New HtmlWeb() Dim doc As HtmlDocument = web.Load(url) Dim row = doc.DocumentNode.SelectNodes("//tr[@class=""row2""]") for each xName in row console.writeline(xName.innertext)code And it works :) –  Niiw Apr 26 at 21:24
    
@Niiw - could you post your solution as an answer, then accept it? That way the solution will be more clear to others with the same problem. –  Kate Paulk Apr 29 at 11:35

1 Answer 1

up vote 0 down vote accepted
 Dim url As String = "http://brayket.byethost9.com/index.php?/shoutbox/"
    Dim web As New HtmlWeb()
    Dim doc As HtmlDocument = web.Load(url)
    Dim names As HtmlNodeCollection = doc.DocumentNode.SelectNodes("//span[@class='shoutbox_text']")

'**Place the code below to read each values between selected nodes.**

For Each useAnyWantedWordHere in names
console.writeline(userAnyWantedWord.InnerText & vbcrlf)
Next
Console.ReadLine()

If you want to make it work with a textbox or richtextbox this is the code :

For Each AnyWantedWord in names
richtextbox1.AppendText(AnyWantedWord.InnerText & vbCrLF)
Next
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.