Hiya, I saw a similar question on a c++ page, figured that maybe this would help out.

I'm trying to write a program that automatically connects to a web site (Yahoo) inputs the screen name and password, logs on and then automatically goes to other spots under my Yahoo.

It's part of a class project we've got a lot of the other parts to the entire problem down, but we are having problems with this step. Effectively our project is to go to yahoo fantasy baseball and have the program automatically make changes in the teams rosters each and every day based upon who is pitching, injured, teams that they are playing etc.

any clue on the best way to do that? (just the login part, the rest we either can figure out, or already have figured out)
Thanks Jim.

Ok, I was able to figure out how to have axwebbrowser help me navigate a web page, my problem is now I need some way of grabbing the cookies that it picked up, so that I can attach it to a post I'm going to send.

(basically I can go to the website, login automatically now, but I have to post a database update which requires me using the cookies that I generated after the login)

I have a problem now. My instructor said to make a program using vb.net and connect it to internet but I can't find the for connecting it I hope you can help me. Thanks.

How did you have your application wait until the page was done loading before continueing?

How did you have your application wait until the page was done loading before continueing?

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted

    End Sub

I have the following code set up under document complete but its still going through the code to fast. Is there a way to slow it down between sites?

Private Sub SignInWebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles SignInWebBrowser1.DocumentCompleted


'Connotea http://www.connotea.org/login

If submitwebnameTxtBox.Text = "Connotea" Then

Try
Static part As Integer
If part = 0 Then
SignInWebBrowser1.Document.GetElementById("username").SetAttribute("value", SubmitUserNameTextBox.Text)
SignInWebBrowser1.Document.GetElementById("password").SetAttribute("value", SubmitPasswordTextBox.Text)

Dim allelements As HtmlElementCollection = SignInWebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("value") = "Login" Then
webpageelement.InvokeMember("click")
End If
Next
part = 1
ElseIf part = 1 Then
part = 2
SignInWebBrowser1.Navigate("http://www.connotea.org/add")
part = 3
ElseIf part = 3 Then
part = 4
Dim allelements As HtmlElementCollection = SignInWebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("id") = "urlbox" Then
webpageelement.SetAttribute("value", URLTextBox.Text)
End If
Next
SignInWebBrowser1.Document.GetElementById("usertitle").SetAttribute("value", TitleTextBox.Text)
SignInWebBrowser1.Document.GetElementById("tags").SetAttribute("value", KeywordsTextBox.Text)
SignInWebBrowser1.Document.GetElementById("description").SetAttribute("value", DescriptionTextBox.Text)
SignInWebBrowser1.Document.GetElementById("mywork").InvokeMember("click")
'SignInWebBrowser1.Document.GetElementById("button").InvokeMember("click")
WebsitesBindingSource.MoveNext()
part = 5
Else
part = 0

End If

Catch ex As Exception
WebsitesBindingSource.MoveNext()
End Try


' ''------NEED TO TAKE OUT THE LINE BELOW
''WebsitesBindingSource.MoveNext()
End If


'Faves https://secure.faves.com/signIn

If submitwebnameTxtBox.Text = "Faves" Then
Try
Static part0 As Integer
If part0 = 0 Then
SignInWebBrowser1.Navigate("http://faves.com/createdot.aspx")
part0 = 1
ElseIf part0 = 1 Then
part0 = 2
Dim allelements As HtmlElementCollection = SignInWebBrowser1.Document.All
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("id") = "rUsername" Then
webpageelement.SetAttribute("value", SubmitUserNameTextBox.Text)
End If
Next
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("name") = "rPassword" Then
webpageelement.SetAttribute("value", SubmitPasswordTextBox.Text)
End If

Next
For Each webpageelement As HtmlElement In allelements
If webpageelement.GetAttribute("name") = "action" Then
webpageelement.InvokeMember("click")
End If
Next
part0 = 3

ElseIf part0 = 3 Then
part0 = 4
SignInWebBrowser1.Document.GetElementById("urlText").SetAttribute("value", URLTextBox.Text)
SignInWebBrowser1.Document.GetElementById("subjectText").SetAttribute("value", TitleTextBox.Text)
SignInWebBrowser1.Document.GetElementById("tagsText").SetAttribute("value", KeywordsTextBox.Text)
SignInWebBrowser1.Document.GetElementById("noteText").SetAttribute("value", DescriptionTextBox.Text)

''Dim allelements As HtmlElementCollection = SignInWebBrowser1.Document.All
'' For Each webpageelement As HtmlElement In allelements

'' If webpageelement.GetAttribute("value") = "Publish" Then
'' webpageelement.InvokeMember("click")

'' End If
'' Next
WebsitesBindingSource.MoveNext()
part0 = 5
Else
part0 = 0

End If


Catch ex As Exception
WebsitesBindingSource.MoveNext()
End Try

I have the following code set up under document complete but its still going through the code to fast. Is there a way to slow it down between sites?

The following code sample will get the innerHtml of a webpage every 5 seconds.
You will need the following prerequisites: WebBrowser, TextBox, Timer.

Public Class Form1
    Private iCount As Integer = 0

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Interval = 1000 '// 1 second delay for each tick.
        WebBrowser1.Navigate("http://www.daniweb.com/forums/post1311892.html#post1311892")
    End Sub

    Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
        Timer1.Start()
    End Sub

    Sub pauseAndContinue()
        TextBox1.Text = WebBrowser1.Document.Body.InnerHtml
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If iCount = 5 Then '// pause for 5 seconds before calling the Sub procedure.
            Timer1.Stop()
            iCount = 0 '// reset timer.
            pauseAndContinue() '// go to procedure.
            Exit Sub '// skip the remaining code.
        End If
        iCount += 1
        Me.Text = iCount '// for testing purposes only.
    End Sub
End Class

how can I get this to navigate to each page and wait for the page to load then move to the next page

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

WebBrowser1.Navigate("http://www.google.com")


WebBrowser1.Navigate("http://www.daniweb.com/forums/post1312057.html#post1312057")


WebBrowser1.Navigate("http://social.msdn.microsoft.com/profile/karl%20grear/?type=forum&referrer=http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/3086f3af-4665-4c79-8b21-e2ece36e50ae/")

WebBrowser1.Navigate("http://www.learnvisualstudio.net/")

End Sub

how can I get this to navigate to each page and wait for the page to load then move to the next page

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

WebBrowser1.Navigate("http://www.google.com")


WebBrowser1.Navigate("http://www.daniweb.com/forums/post1312057.html#post1312057")


WebBrowser1.Navigate("http://social.msdn.microsoft.com/profile/karl%20grear/?type=forum&referrer=http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/3086f3af-4665-4c79-8b21-e2ece36e50ae/")

WebBrowser1.Navigate("http://www.learnvisualstudio.net/")

End Sub

Since your question does not relate to this thread, Please Start a New Thread.
Also, since you posted code and if someone wants to find a similar solution, post the link to you New Thread here.
Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.