1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Correct Captcha on the 2nd try [HELP]

Discussion in 'Visual Basic .NET' started by Fadi946, Nov 5, 2011.

  1. Fadi946

    Fadi946 Power Member

    Joined:
    Mar 25, 2009
    Messages:
    526
    Likes Received:
    77
    Location:
    With my parents :(
    Hi guys! So I've been making a YouTube bot this week, and I came across this problem:
    Everything works just fine, but there is a problem with the Catpcha... I need to get 2 correct Captcha right to let it work.
    For example:
    I get "XYZ", I put it correctly, but it doesn't continue.. it gives me another picture "YXZ", I put it correctly and it continues.
    I do not know why this is happening to me! Can anyone tell me what's going on?
    PS: Manually it works fine on the first attempt.
    I will post the code for the captcha form, Here:

    Edit 1: When I try to do it manually using Internet Explorer, I noticed that everytime I finish a captcha and submit, a window pops up saying "Set or Add google as your homepage" with "Yes" and "No" options, after clicking "Yes" (So I can get rid of it) it refreshes the page and I need to put the info again, and after doing it on the second time, it doesn't ask me anything and it works fine (continues to the next page).
    I thought this was the problem, but I fixed it that it will not pop up the window... didn't help, I still need to do the Captcha twice =\

    EDIT 2 : STILL DOESNT WORK! Please help =S Here is the code again:

    Code:
    
    Imports System.Runtime.InteropServices
    Imports System.Net
    Imports mshtml
    Imports System.IO
    Imports System.Web
    
    Public Class Form2
        Dim timer1ticker As Integer
    
        Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Button1.Enabled = True
            Timer1.Enabled = True
            timer1ticker = 10
            Form1.Label13.Text = timer1ticker
            TextBox1.Clear()
            Dim doc As IHTMLDocument2 = Form1.WebBrowser1.Document.DomDocument
            Dim imgRange As IHTMLControlRange = CType(doc.body, HTMLBody).createControlRange
            For Each img As IHTMLImgElement In doc.images
                If img.GetAttribute("src").ToString.Contains("https://accounts.google.com/Captcha?ctoken=") Then
                    imgRange.add(img)
                    imgRange.execCommand("Copy", False, Nothing)
                    PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
                    Exit For
                End If
            Next
            If Form1.WebBrowser1.DocumentText.Contains("Phone") Then
                Timer1.Enabled = False
                Form1.Timer1.Enabled = False
                Form1.Timer2.Enabled = False
                Form1.Timer3.Enabled = False
                Exit Sub
            End If
    
    
        End Sub
    
        '------------------- 'Captcha Window' ---------------'
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Button1.Enabled = False
            Form1.Label13.Text = timer1ticker
            Form1.WebBrowser1.Document.GetElementById("newaccountcaptcha").SetAttribute("value", TextBox1.Text)
            Form1.WebBrowser1.Document.GetElementById("submitbutton").InvokeMember("click")
    
            Do While Form1.WebBrowser1.ReadyState <> WebBrowserReadyState.Complete Or Form1.WebBrowser1.IsBusy
                Threading.Thread.Sleep(100)
                My.Application.DoEvents()
            Loop
            timer1ticker = 10
            Timer1.Enabled = True
    
            If Form1.WebBrowser1.DocumentText.Contains("Phone") Then
                Timer1.Enabled = False
                Form1.Timer1.Enabled = False
                Form1.Timer2.Enabled = False
                Form1.Timer3.Enabled = False
                Exit Sub
            End If
        End Sub
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            timer1ticker = timer1ticker - 1
            Form1.Label13.Text = timer1ticker
            If timer1ticker = 8 Then
                Do While Form1.WebBrowser1.ReadyState <> WebBrowserReadyState.Complete Or Form1.WebBrowser1.IsBusy
                    Threading.Thread.Sleep(100)
                    My.Application.DoEvents()
                Loop
                If Form1.WebBrowser1.Url.ToString().Contains("nts.google.com/NewAccount") Or Form1.WebBrowser1.Url.ToString().Contains("nts.google.com/CreateAccount") Then
    
                    Button1.Enabled = True
                    TextBox1.Clear()
                    Dim doc As IHTMLDocument2 = Form1.WebBrowser1.Document.DomDocument
                    Dim imgRange As IHTMLControlRange = CType(doc.body, HTMLBody).createControlRange
                    For Each img As IHTMLImgElement In doc.images
                        If img.GetAttribute("src").ToString.Contains("https://accounts.google.com/Captcha?ctoken=") Then
                            imgRange.add(img)
                            imgRange.execCommand("Copy", False, Nothing)
                            PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
                            Exit For
                        End If
                    Next
                    If Form1.WebBrowser1.DocumentText.Contains("Re-enter password") Then
                        Form1.WebBrowser1.Document.GetElementById("Email").InnerText = Form1.currentemail
                        Form1.WebBrowser1.Document.GetElementById("Passwd").InnerText = Form1.TextBox6.Text
                        Form1.WebBrowser1.Document.GetElementById("PasswdAgain").InnerText = Form1.TextBox6.Text
                        Form1.WebBrowser1.Document.GetElementById("Birthday").InnerText = "08/04/1990"
    
                        Timer1.Enabled = False
    
                    End If
                Else
                    Timer1.Enabled = False
                    Form1.timer2ticker = 10
                    Form1.Timer2.Enabled = True
                    Me.Hide()
                    Timer1.Enabled = False
    
                End If
    
            End If
            If Form1.WebBrowser1.DocumentText.Contains("Phone") Then
                Timer1.Enabled = False
                Form1.Timer1.Enabled = False
                Form1.Timer2.Enabled = False
                Form1.Timer3.Enabled = False
                Exit Sub
            End If
    
        End Sub
    
        Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
            If (e.KeyCode = Keys.Enter) Then
                Button1.PerformClick()
            End If
        End Sub
    
    
    End Class
    
    
    
     
    Last edited: Nov 5, 2011
  2. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    169
    Likes Received:
    13
    • Thanks Thanks x 1
  3. WeissHut

    WeissHut Newbie

    Joined:
    Nov 23, 2011
    Messages:
    3
    Likes Received:
    0
    Fadi946, how do you solve the Google captchas?

    Thanks
    WeissHut
     
  4. Gondal

    Gondal Newbie

    Joined:
    Oct 13, 2011
    Messages:
    15
    Likes Received:
    0
    Can't find anything useful in the captcha file :(
     
  5. InternetUser

    InternetUser Senior Member

    Joined:
    Jan 21, 2011
    Messages:
    997
    Likes Received:
    886
    Location:
    Earth
    Been having this problem with yahoo too, ha.
     
  6. specopkirbs

    specopkirbs BANNED BANNED

    Joined:
    Nov 28, 2008
    Messages:
    920
    Likes Received:
    746
    :p
    yup likewise, is it just a webbrowser issue or is the same problem with webrequests