تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] سؤال فتح ايميل بشكل تلقائي
#2
استعمل كود Auto Login
Public Class Browser

كود :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  'Part 1: Load Yahoo login page in Form_Load event  
  WebBrowser1.Navigate("http://websiteurl/")
End Sub

Private Sub WebBrowser1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted
  'Part 2: Locate the Username TextBox and automatically input your username  
  '<INPUT class=yreg_ipt id=username maxLength=96 size=17 name=login>  
  Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
  For Each curElement As HtmlElement In theElementCollection
      Dim controlName As String = curElement.GetAttribute("id").ToString
      If controlName = "username" Then
          curElement.SetAttribute("Value", LoginForm.RadTextBoxUser.Text)
      End If
  Next

  'Part 3: Locate the Password TextBox and automatically input your password  
  '<INPUT class=yreg_ipt id=passwd type=password maxLength=64 size=17 value="" name=passwd>  
  theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
  For Each curElement As HtmlElement In theElementCollection
      Dim controlName As String = curElement.GetAttribute("id").ToString
      If controlName = "passwd" Then
          curElement.SetAttribute("Value", LoginForm.RadTextBoxPass.Text)
      End If
  Next

  'Part 4: Locate the "Sign In" Button and automatically click it  
  '<INPUT type=submit value="Sign In" name=.save>  
  theElementCollection = WebBrowser1.Document.GetElementsByTagName("Input")
  For Each curElement As HtmlElement In theElementCollection
      If curElement.GetAttribute("value").Equals("Sign In") Then
          curElement.InvokeMember("click")
          'Javascript has a click method for we need to invoke on the current submit button element.  
      End If
  Next
End Sub

End Class
الرد }}}
تم الشكر بواسطة:


الردود في هذا الموضوع
RE: سؤال فتح ايميل بشكل تلقائي - بواسطة ramygamalvb - 06-04-16, 05:47 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم