ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ¦p¦ó¥Îvba°õ¦æºô­¶¿ï¾ÜÀɮתº¥\¯à?

[µo°Ý] ¦p¦ó¥Îvba°õ¦æºô­¶¿ï¾ÜÀɮתº¥\¯à?

ºô§}:
  1. https://www.pinkoi.com/
½Æ»s¥N½X
³o­Óºô¯¸¥i¥Hª½±µ¥Îfbµn¤J
µù¥U¤§«á·|¦³«H¥ó,¥´¶}«H¥ó¦³­Ó¦a¤è¥i¥H¿ï¾ÜÀɮצp¹Ï¤ù

¦p¦P³Â»¶®a±Úªºªþ¥óªº¿ï¾ÜÀɮפ]¬O¤@¼Ë,«ö¤U¥h¤§«á³£·|°±¤î°Ê§@,°£«D¤â°ÊÃö³¬¸Óµøµ¡,½Ð°Ý¦³¦p¦ó¸Ñ¨M³o­Ó°ÝÃD©O?

¦ýµ{¦¡¤@¥¹.Click ³o­Ó¿ï¾ÜÀɮתº«ö¶s¤§«á´NµLªk°Ê§@¤F
¥²¶·­n¤â°ÊÃö³¬¸Óµøµ¡¤~¥i¥HÄ~Äò°Ê§@
½Ð°Ý­n¦p¦ó¸Ñ¨M³o­Ó°ÝÃD©O?

PS:³\¦hºô¯¸³£¦³¬Û¦Pªº³o­Ó°ÝÃD,ÁٽЦU¦ì¤j¤jÀ°¦£¸Ñ¨M
PKKO

  1. Sub test()
  2. 'PS:­n¦Û¤v¥ý¥Îie¶}±Òhttps://www.pinkoi.com/ºô§}
  3. '¨Ã¥B¥ÎFBÂI¿ïµn¤J,¤£µM¤U¦C»yªk±N·|§ä¤£¨ì¶Ç°e°T®§ªº³¡¤À,­n¦³µn¤J¤~¥i¶Ç°e°T®§µ¹§O¤H
  4. Set IE = CreateObject("InternetExplorer.Application")
  5. IE.Visible = True
  6. IE.Navigate "https://www.pinkoi.com/user/testpkko"
  7. Do While IE.Busy Or IE.readyState <> 4: DoEvents: Loop
  8. With IE.Document
  9.     i = 0: On Error Resume Next
  10.     For Each E In .GetElementsByTagName("A")
  11.         A = E.Text
  12.         If CStr(A) = "¶Ç°e°T®§" Then
  13.             E.Click '³oÃä©I¥s¥X¶Ç°e°T®§ªºµøµ¡
  14.             '­n¦p¦ó±±¨î¸Óµøµ¡¿é¤J¥D¦®+¤º¤å+¿ï¾ÜÀɮשO?
  15.             
  16.             Call WEB_DETAIL(IE) '§Ú¥Îºô­¶¤¸¯Àªº³¡¤ÀµLªk¬d¤£¥X¬ÛÃö¸ê°T
  17.         End If
  18.     Next
  19. End With
  20. End Sub
½Æ»s¥N½X
  1. Sub WEB_DETAIL(IE)
  2. With IE
  3.     Do While .Busy Or .readyState <> 4: DoEvents: Loop
  4.     With .Document
  5.         i = 0: On Error Resume Next
  6.         For Each E In .ALL
  7.             i = i + 1
  8.             Cells(i, "a") = E.tagname
  9.             Cells(i, "b") = E.ID
  10.             Cells(i, "c") = E.Name
  11.             Cells(i, "d") = E.Value
  12.             Cells(i, "e") = E.innertext
  13.             Cells(i, "f") = E.Type
  14.             Cells(i, "g") = E.href
  15.             Cells(i, "H") = E.Text
  16.         Next
  17.     End With
  18. End With
  19. End Sub
½Æ»s¥N½X
PKKO

TOP

¥»©«³Ì«á¥Ñ PKKO ©ó 2017-1-5 15:01 ½s¿è

§Ú¤w¸g§â§¹¾ãªºµn¤Jµ{¦¡½X¥H¤Î¸õ¥Xªí³æªºµ{¦¡½X³£§¹¦¨
¦ý¬O­n¦p¦ó¤~¯à°÷±N¸õ¥Xªºªí³æ¿é¤J¥D¦®©M¤º¤å¥H¤Î¿ï¾ÜÀɮרåB±H¥X¸ê®Æ©O?
  1. Sub test()
  2. Dim ie As Object 'SHDocVw.InternetExplorer
  3. Set ie = CreateObject("InternetExplorer.Application")
  4. Call login(ie) 'just for login
  5. Call show_the_form(ie) 'My problem in here
  6. End Sub
  7. Sub login(ie)
  8. ie.Visible = True
  9. ie.Navigate "https://www.pinkoi.com/user/testpkko"
  10. Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop


  11. Dim anchorTags As Object 'MSHTML.IHTMLElementCollection
  12. Set anchorTags = ie.document.GetElementsByTagName("A")

  13. Dim oAnchorLoop As Object 'MSHTML.IHTMLAnchorElement
  14. For Each oAnchorLoop In anchorTags
  15.     Dim anchorText As String
  16.     anchorText = oAnchorLoop.Text
  17.     If anchorText = ChrW(20659) & ChrW(36865) & ChrW(35338) & ChrW(24687) Then
  18.         Dim oAnchorLogon As Object 'MSHTML.IHTMLAnchorElement2
  19.         Set oAnchorLogon = oAnchorLoop
  20.         oAnchorLogon.Click
  21.         Exit For
  22.     End If
  23. Next

  24. Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop
  25. '* so now logon form should be visible

  26. On Error Resume Next
  27. Dim oUserNameInput As Object 'MSHTML.IHTMLInputElement
  28. Set oUserNameInput = ie.document.getElementById("n-login-id")
  29. nowtime = Timer
  30. Do While ie.Busy Or ie.readyState <> 4 Or oUserNameInput Is Nothing
  31.     DoEvents
  32.     If Timer - nowtime > 1 Then Exit Do 'Already logoin
  33.     Set oUserNameInput = ie.document.getElementById("n-login-id")
  34. Loop

  35. oUserNameInput.Value = "testpkko"

  36. Dim oUserPassword As Object 'MSHTML.IHTMLInputElement
  37. Set oUserPassword = ie.document.getElementById("n-login-password")

  38. oUserPassword.Value = "abc123"


  39. Dim oListElement As Object 'MSHTML.HTMLLIElement
  40. Set oListElement = oUserNameInput.parentElement

  41. Dim oUnorderedList As Object 'MSHTML.IHTMLUListElement
  42. Set oUnorderedList = oListElement.parentElement

  43. Dim oForm As Object 'MSHTML.IHTMLFormElement
  44. Set oForm = oUnorderedList.parentElement

  45. Dim oSubmitInputElememt As Object 'MSHTML.HTMLInputElement
  46. Set oSubmitInputElememt = Nothing

  47. Dim lFormChildrenLoop As Long
  48. For lFormChildrenLoop = 1 To oForm.all.Length

  49. If oForm.elements.Item(lFormChildrenLoop).Type = "submit" Then
  50.     Set oSubmitInputElememt = oForm.elements.Item(lFormChildrenLoop)
  51.     Exit For

  52. End If

  53. Next lFormChildrenLoop
  54. If Not oSubmitInputElememt Is Nothing Then
  55.     'Stop '* get ready .....
  56.     oSubmitInputElememt.Click
  57.     Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop
  58. End If
  59. End Sub
  60. Sub show_the_form(ie)
  61. Application.Wait Now + TimeValue("00:00:03")

  62. ie.Navigate "https://www.pinkoi.com/user/testpkko2" 'After login we can trip to other people website
  63. Do While ie.Busy Or ie.readyState <> 4: DoEvents: Loop
  64. With ie.document
  65. On Error Resume Next
  66. For Each E In .GetElementsByTagName("A")
  67.     a = E.Text
  68.     If CStr(a) = "¶Ç°e°T®§" Then
  69.         E.Click '³oÃä·|¸õ¥X±H°eªºªí³æ,­n¦p¦ó¿é¤J¥D¦®¥H¤Î¤º¤å©M¿ï¾ÜÀɮרëö¤U±H°e«ö¶s©O?
  70.     End If
  71. Next
  72. End With
  73. End Sub
½Æ»s¥N½X
PKKO

TOP

¦^´_ 7# singo1232001


    «D±`·PÁ±zªº¦^µª¡A§Ú¨ü¯q¤F¤T­Ó³¡¤À
¤@¡B­ì¨Ó¥i¥H¤£¥Î¨C¦¸³£¶}±Ò·sªºIE,³o­Ó¹ï§ÚÀ°§U«Ü¤j
¤G¡B§Ú¤§«e³£¬O³z¹L¥t¥~¤@­Ó¤èªk±Nºô­¶²¾¨ì³Ì«eºÝ(µ{¦¡½X¸ûªø¡A±zªº¤èªk§ó²³æ¤F)
  1. ie.Visible = False     ''´N¬O±q·sÁôÂèϥεøµ¡
  2.                 ie.Visible = True      ''±µµÛ¤S­«·sÅã¥Üactive¨Ï¥Îµøµ¡
  3.                     ie.document.Focus
½Æ»s¥N½X
¤T¡B­ì¨Ó·í«ö¤U«ö¶sµ{¦¡½X·|µLªk°Ê§@ªº®É­Ô¡A¥t¥~¤@­Ó³]©w®É¶¡±Ò°Êªº¥¨¶°¤]µLªk±Ò°Ê(§Ú­ì¥»¤]­n°µ¹êÅç¤F¡A¬Ù¤U¤F°µ¹êÅ窺®É¶¡)
±zªº°ÝÃD§Ú¤w¸g¬Ý¨ì¥t¥~¤@½g¤å³¹,§Ú°µÂI¹êÅ礧«á¦A¤@°_¦^´_±z!
PKKO

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD