Board logo

標題: [發問] 如何用下載的方式,卻又可以登入網站? [打印本頁]

作者: PKKO    時間: 2016-10-25 11:30     標題: 如何用下載的方式,卻又可以登入網站?

小弟已經透過網頁元素可以用下列方式登入成功
  1. Sub TEST()
  2. With CreateObject("InternetExplorer.Application")
  3.     .Visible = True
  4.     .Navigate "https://en.surebet.com/users/sign_in"
  5.     Do While .Busy Or .readyState <> 4: DoEvents: Loop
  6.     With .Document
  7.         .GetElementByid("user_email").Value = "[email protected]" '帳號
  8.         .GetElementByid("user_password").Value = "XXX" '密碼
  9.         .GetElementByid("sign_in_user").Click
  10.     End With
  11. End With
  12. End Sub
複製代碼
但是資料的部分想要用下列的下載方式
  1. Sub TEST2()
  2. Dim QT As QueryTable
  3. Dim WebAddress As String
  4. '登入網址:https://en.surebet.com/users/sign_in
  5. '目的地網址:https://en.surebet.com/surebets/group?controller=surebets&like=562651712
  6. WebAddress = ""

  7. With ThisWorkbook.Worksheets("下載")
  8. .Cells.Clear
  9. Set QT = .QueryTables.Add("URL;" & WebAddress, .range("$A$1"))
  10. End With
  11. With QT
  12. '.PostText = 這邊不知道要如何輸入帳號+密碼
  13. '這邊也不曉得該如何按下登入的按鈕
  14. '以及不曉得登入之後要如何轉向第二個網址?
  15. .WebTables = "2"
  16. .Refresh False
  17. .Delete
  18. End With
  19. End Sub
複製代碼
但卻無法登入網站,請問要如何透過下載的方式來登入網站並轉換第二個網址呢?
還是有大大可以透過第一個網頁元素的方式,然後透過該ie直接用第二個方式下載?




歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)