返回列表 上一主題 發帖

[發問] 網頁登入-按鈕問題!

http://www.slc.com.tw/custom/gas/custom/index.php
大大 那這個網站幫我試試看 只要能按下去顯示帳號密碼錯誤就對了 @@"
因為我現在是連按都按不下去!@@
引用麻辣家族來修正
  1. Option Explicit
  2. Sub 麻辣家族討論版用戶登錄()
  3.    Dim IE As New InternetExplorer, i As Integer, vDoc As Object
  4.     '宣告 Dim ie As New InternetExplorer
  5.     '須在工具-> 設定引用項目加入 新增引用 Microsoft Internet Controls
  6.     'Dim i As Integer, vDoc As Object
  7.     'With CreateObject("InternetExplorer.Application") '不需新增引用 Microsoft Internet Controls
  8.     With IE
  9.         .Visible = True
  10.         .Navigate "http://www.slc.com.tw/custom/gas/custom/index.php"
  11.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  12.         Set vDoc = .Document.getElementsByTagName("INPUT")
  13.         For i = 0 To vDoc.Length - 1
  14.             If vDoc(i).Name = "f_account" Then vDoc(i).Value = "8888"    '用戶名稱 請修改
  15.             If vDoc(i).Name = "f_psd" Then vDoc(i).Value = "8888"  '用戶密碼 請修改
  16.         Next
  17.         Set vDoc = .Document.getElementsByTagName("button") '.Click
  18.         For i = 0 To vDoc.Length - 1
  19.             If vDoc(i).Name = "c_psd" Then vDoc(i).Click
  20.         Next
  21.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  22.     End With
  23. End Sub
複製代碼
自用車也可以簽帳喔!
五千元加油金加入油箱後還回饋您6200元
福利旺車友會power-want.com

TOP

回復 3# die78325
是攸關公司配合的帳號密碼  不方便在此PO語法或檔案
可參考看看
  1. Option Explicit
  2. Sub 麻辣家族討論版用戶登錄()
  3.    Dim IE As New InternetExplorer, i As Integer, vDoc As Object
  4.     '宣告 Dim ie As New InternetExplorer
  5.     '須在工具-> 設定引用項目加入 新增引用 Microsoft Internet Controls
  6.     'Dim i As Integer, vDoc As Object
  7.     'With CreateObject("InternetExplorer.Application") '不需新增引用 Microsoft Internet Controls
  8.     With IE
  9.         .Visible = True
  10.         .Navigate "http://forum.twbts.com/logging.php?action=login"
  11.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  12.         Set vDoc = .Document.getElementsByTagName("INPUT")
  13.         For i = 0 To vDoc.Length - 1
  14.             If vDoc(i).Name = "username" Then vDoc(i).Value = "?????"    '用戶名稱 請修改
  15.             If vDoc(i).Name = "password" Then vDoc(i).Value = "*******"  '用戶密碼 請修改
  16.         Next
  17.         Set vDoc = .Document.getElementsByTagName("button") '.Click
  18.         For i = 0 To vDoc.Length - 1
  19.             If vDoc(i).Name = "loginsubmit" Then vDoc(i).Click
  20.         Next
  21.         Do While .Busy Or .ReadyState <> 4: DoEvents: Loop
  22.     End With
  23. End Sub
  24. Sub 麻辣家族討論版用戶退出()
  25. Dim i As Integer, vDoc As Object
  26.      With CreateObject("InternetExplorer.Application") '不需新增引用 Microsoft Internet Controls
  27.         .Visible = True
  28.         .Navigate "http://forum.twbts.com/logging.php?action=logout&formhash=053f893b"
  29.         .Quit           '關閉網頁
  30.     End With
  31. End Sub
複製代碼

TOP

本帖最後由 die78325 於 2012-12-3 10:10 編輯

回復 2# GBKEE


    大大  我上面打錯  我用的跟你用的一樣= ="!!   但是會錯誤 !     "c_psd()"      不知為何他會有()
   依然停留在登入頁面卻沒按確定進去@@" 怪怪的= ="手動按就OK
   還是因為我是用UserForm1.WebBrowser1來開啟網頁的關係= =?   
  我比較希望可以用IE來操作 但 改成IE的話 有些語法我不會改 變成他不會去偵測欄位
    Dim IE As New InternetExplorer
    sURL = "XXX"
    Set IE = CreateObject("InternetExplorer.Application")
   Set vDoc = IE.Document   ((我會改成IE開啟  但到這一步就掛了   原本用  Set vDoc = myWeb.Document  可以))   <紅色為錯誤>

我另一個網站   打入帳號密碼 登入鍵部會亮((會灰色按鈕))
但是用鍵盤隨便輸入一個英文 就會亮了 所以他需要偵測鍵盤輸入才可以  那怎麼解決??  

大大 不是我不PO檔案給你測試 是因為這是攸關公司配合的帳號密碼  不方便在此PO語法或檔案
自用車也可以簽帳喔!
五千元加油金加入油箱後還回饋您6200元
福利旺車友會power-want.com

TOP

回復 1# die78325
試試看
myWeb.Document.all("c_psd").Click

TOP

        靜思自在 : 人生最大的成就是從失敗中站起來。
返回列表 上一主題