-
Sep 1st, 2013, 04:27 PM
#1
Thread Starter
Lively Member
Loop for a web bot
well, i'm working in a bot for a web page, i know how to get the values of things that i want, but i have a problem.
When i do that..
Code:
Dim allelements As HtmlElementCollection = WebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("className") = "mi_class_name_asd" Then
frmPreciosEncontrados.Label23.Text = webpageelement.InnerText
End If
Next
I get the first value of a list of values, all of them have the same classname( in the code ' mi_class_name_asd', for using it in a string in other form.
What i want is to get ten values with the same classname and put it in different strings.
Idk how to do it..
Sorry if bad english, im spanish and my level of english is....
Thanks for all and i wait for a reply.
-
Sep 1st, 2013, 06:43 PM
#2
Re: Loop for a web bot
Instead of setting the Text of the same Label each time, Add the values to a List(Of String). Once the loop is done you can then Join that list into one String or do whatever else is appropriate.
-
Sep 1st, 2013, 07:46 PM
#3
Thread Starter
Lively Member
Re: Loop for a web bot
EDIT: Loop is done perfectly. In the list appears all i need.
Code I used:
Code:
Dim PageElement As HtmlElementCollection = WebBrowser1.Document.All
For Each CurElement As HtmlElement In PageElement
If (CurElement.GetAttribute("className") = "mi class name") Then
Form1.ListBox1.Items.Add(CurElement.GetAttribute("innerText").ToString)
End If
Next
Im wanna make a switch with a string to set the other strings.
Thanks for all.
And plz dont close the post, i will tell if works or i need more help..
Last edited by public; Sep 1st, 2013 at 08:03 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|