回復 1#singo1232001
提供另一種繞過 alert 視窗的方法
Sub test()
Dim x
Dim oie As Object: Set oie = CreateObject("internetexplorer.application")
With oie
.Visible = True
.Navigate "https://login.104.com.tw/login.cfm"
Do While .readystate <> 4 Or .busy: DoEvents: Loop
.Document.getelementByid("id_name").Value = "aaa"
For Each x In .Document.getElementsByTagName("input")
If x.Type = "submit" And x.Value = "會員登入" Then
With .Document.parentWindow
.execScript "window.nativeAlert = window.alert" '儲存原始的alert
.execScript "window.alert = function() {}" '覆寫alert function
x.Click
.execScript "window.alert = window.nativeAlert" '還原原始的alert
End With
Exit For
End If
Next
Do While .readystate <> 4 Or .busy: DoEvents: Loop
.Quit
End With
End Sub作者: singo1232001 時間: 2017-1-11 09:07