منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[سؤال] سؤال فتح ايميل بشكل تلقائي - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [سؤال] سؤال فتح ايميل بشكل تلقائي (/showthread.php?tid=15372)



سؤال فتح ايميل بشكل تلقائي - عبد الرحمن متولي - 06-04-16

السلام عليكم

انا هعمل برنامج بيفتح ايميل تلقائي يعني انا هوضع رابط موقع في ويب براوزر

وعاوز انا احط الايميل في الاكواد علشان يفتح الايميل تلقائي في طريقة ولا لا


RE: سؤال فتح ايميل بشكل تلقائي - ramygamalvb - 06-04-16

استعمل كود 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: سؤال فتح ايميل بشكل تلقائي - عبد الرحمن متولي - 06-04-16

(06-04-16, 05:47 PM)ramygamalvb كتب : استعمل كود 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

طيب ممكن تظبطهم في مشروع صغير

(06-04-16, 05:47 PM)ramygamalvb كتب : استعمل كود 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

تمام استاذ رامي بس المشكلة انه الرابط مش بيفتح في ويب براوزير بيجيبلي خطا وعاوز اعرف ازاي اغير الايميل والباس عن بعد تلقائي ولك جزيل الشكر