10/06/11 16:02
federiko
ciao ragazzi vorrei sapere come creare un programma x il login automatico sul sito megaupload.com.. fino ad ora ho creato una pezzo di codice ma mi da errore errore a questa riga:"but1 = WebBrowser1.Document.GetElementById("a href=javascript:void(0)".DomElement"
Public Class Form1 Dim whereami As Integer Dim loggedin As Boolean Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load whereami = 0 loggedin = False WebBrowser1.Navigate("http://www.megaupload.com/?c=login") End Sub Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted If whereami = 0 Then Dim but1 As Object WebBrowser1.Document.GetElementById("username").SetAttribute("value", "username1") WebBrowser1.Document.GetElementById("password").SetAttribute("value", "1234567") but1 = WebBrowser1.Document.GetElementById("a href=javascript:void(0)").DomElement but1.Click() whereami = whereami + 1 Exit Sub ElseIf whereami = 1 Then WebBrowser1.Navigate("http://www.megaupload.com/?c=login") whereami = whereami + 1 Exit Sub ElseIf whereami = 2 Then Dim dom As Object dom = WebBrowser1.Document.DomDocument dom.Links(1).Click() whereami = whereami + 1 loggedin = True Exit Sub End If End Sub Sub placebets(ByVal batchbets As String) Dim olddate As Date Dim procs() As Process WebBrowser1.Document.GetElementById("BvTextArea").InnerText = batchbets ClickLink(WebBrowser1.Document.DomDocument, "SUBMIT BATCH") olddate = Now 'Wait five seconds until the confirmation window opens Do Application.DoEvents() Loop Until DateDiff(DateInterval.Second, olddate, Now) >= 5 Or DateDiff(DateInterval.Second, olddate, Now) <= -5 procs = Process.GetProcesses() 'close confirmation window For i = 0 To procs.Length - 1 If procs(i).MainWindowTitle = "https://www.tab.com.au/?State=1 - BetReceiptSummary - Windows Internet Explorer" Then procs(i).CloseMainWindow() Exit For End If Next End Sub Sub ClickLink(ByVal doc As Object, ByVal LinkText As String) For i = 0 To doc.Links.Length - 1 If LTrim(RTrim(doc.Links(i).OuterText)) = LinkText Then doc.Links(i).Click() Exit For End If Next i End Sub End Class
aaa