WebBrowser打不开网页,系统浏览器可以,求解。
WebBrowser1.Navigate "http://www.eaysun.com/incs/loginverify.asp"
用这个控件打开后面的网页,提示“无法加载”,但是系统浏览器访问正常,求解决方法。
我是想获取这个网页里面的验证码输入到Image控件,但是现在都不能打开这个页面。
下面是取得验证码的代码,下面的代码提取其他网页的验证码测试通过,例如这个:http://www.monternet.com/authcode
--------------------------------------------------------------------------
Private Sub Form_Load()
WebBrowser1.Navigate "http://www.eaysun.com/incs/loginverify.asp"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim X, CtrlRange
Dim ii As Long
ii = 0
For Each X In WebBrowser1.Document.All
If X.tagname = "IMG" Then
If LCase(X.src) = "http://www.eaysun.com/incs/loginverify.asp" Then
Set CtrlRange = WebBrowser1.Document.body.createControlRange()
CtrlRange.Add (X)
CtrlRange.execCommand ("Copy") '获取验证码
Image1.Picture = Clipboard.GetData '在Image1控件上显示
Exit Sub
End If
ii = ii + 1
End If
Next
End Sub
--------------------------------------------------------------------------
现在求取这个网页的验证码方法:http://www.eaysun.com/incs/loginverify.asp
[解决办法]
Private Sub Form_Load()
WebBrowser1.Navigate "about:blank"
DoEvents
WebBrowser1.Navigate "http://www.eaysun.com/incs/loginverify.asp"
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim X, CtrlRange
Dim ii As Long
ii = 0
For Each X In WebBrowser1.Document.All
If X.tagname = "IMG" Then
If LCase(X.src) = "http://www.eaysun.com/incs/loginverify.asp" Then
Set CtrlRange = WebBrowser1.Document.body.createControlRange()
CtrlRange.Add (X)
CtrlRange.execCommand ("Copy") '获取验证码
Image1.Picture = Clipboard.GetData '在Image1控件上显示
Exit Sub
End If
ii = ii + 1
End If
Next
End Sub
Option Explicit
Private Sub Form_Load()
WebBrowser1.Navigate "about:blank"
End Sub
Private Sub Command1_Click()
WebBrowser1.Document.body.innerHTML = "<IMG height=28 src=""http://www.eaysun.com/incs/loginverify.asp"" width=""100"">"
End Sub
Private Sub Form_Load()
DoEvents
Web1.Navigate "http://www.eaysun.com/incs/loginverify.asp"
End Sub
Private Sub Form_Load()
DoEvents
Web1.Navigate "http://www.eaysun.com/incs/loginverify.asp"
End Sub
Private Sub Web1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
On Error Resume Next
Dim X, CtrlRange
Dim ii As Long
ii = 0
For Each X In Web1.Document.All
If X.tagname = "IMG" Then
If LCase(X.src) = "http://www.eaysun.com/incs/loginverify.asp" Then
Set CtrlRange = Web1.Document.body.createControlRange()
CtrlRange.Add (X)
CtrlRange.execCommand ("Copy") '获取验证码
Image1.Picture = Clipboard.GetData '在Image1控件上显示
Exit Sub
End If
ii = ii + 1
End If
Next
End Sub