Advertisement
Guest User

Untitled

a guest
Jul 4th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.50 KB | None | 0 0
  1. 'Define Store variable
  2. Dim Store As String
  3. Store = Me.TextBox1.Text
  4. 'Define IP Address variable
  5. Dim IPAddress As String
  6. IPAddress = Me.TextBox2.Text
  7. 'Define Username variable
  8. Dim Username As String
  9. Username = Me.TextBox3.Text
  10. 'Define Password variable
  11. Dim Password As String
  12. Password = Me.TextBox4.Text
  13.  
  14. ' Open Store Specific URL 1
  15. Dim IE As Object 'Internet explorer object
  16. Dim objCollection1 As Object 'Variable used for cycling through different elements
  17. Dim objCollection2 As Object 'Variable used for cycling through different elements
  18. Dim objCollection3 As Object 'Variable used for cycling through different elements
  19. Dim objCollection4 As Object 'Variable used for cycling through different elements
  20. Dim objCollection5 As Object 'Variable used for cycling through different elements
  21. Dim objCollectionA As Object 'Variable used for cycling through different elements
  22.  
  23. 'Create IE Object
  24. IE = CreateObject("InternetExplorer.Application")
  25. IE.Visible = True
  26. IE.Navigate("http://" & IPAddress & ":8080/")
  27.  
  28. Do While IE.Busy
  29. Application.DoEvents() 'This allows the site to load first
  30. Loop
  31.  
  32. 'Find the field you are looking for and store it into the objCollection variable
  33. objCollection1 = IE.document.getelementsbyname("txtDeviceName")
  34. objCollection2 = IE.document.getelementsbyname("txtName")
  35. objCollection3 = IE.document.getelementsbyname("txtUID")
  36. objCollection4 = IE.document.getelementsbyname("txtPWD")
  37. objCollection5 = IE.document.getelementsbyname("txtOrgID")
  38. objCollectionA = IE.document.getelementsbyname("imgReregister")
  39.  
  40. 'Call element, and set value equal to the data you have from your form
  41. objCollection1(0).Value = "ALL.MONSOON." & Store
  42. objCollection2(0).Value = "ALL.MONSOON." & Store
  43. objCollection3(0).Value = Username
  44. objCollection4(0).Value = Password
  45. objCollection5(0).Value = "MONSOON"
  46.  
  47. objCollectionA.getElementById("imgReregister").click()
  48.  
  49. ************** Exception Text **************
  50. System.MissingMemberException: Public member 'getElementById' on type 'DispHTMLElementCollection' not found.
  51. at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
  52. at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
  53. at WindowsApp1.Form1.Button1_Click(Object sender, EventArgs e)
  54. at System.Windows.Forms.Control.OnClick(EventArgs e)
  55. at System.Windows.Forms.Button.OnClick(EventArgs e)
  56. at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
  57. at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
  58. at System.Windows.Forms.Control.WndProc(Message& m)
  59. at System.Windows.Forms.ButtonBase.WndProc(Message& m)
  60. at System.Windows.Forms.Button.WndProc(Message& m)
  61. at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  62. at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  63. at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  64.  
  65. input name="imgReregister" title="Register" class="image" id="imgReregister" type="image" src="../images/next.gif"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement