#2
阳光上的桥2023-03-23 09:06
|
内嵌框架网页https://XXXX.(此网页单独登录提示失败,需点击主页右上角“登录”来登录账号)
问题描述:VB6.0在网页弹窗登录界面自动填表失败,代码如下。
Private Sub Command1_Click()
Randomize
On Error Resume Next
Dim a As Variant
Dim Vdoc As MSHTML.HTMLDocument
Set Vdoc = WebBrowser1.document
For Each a In Vdoc.getElementsByTagName("input")
Select Case a.Name
Case "username"
a.Value = "13888888888"
Case "password"
a.Value = "123456"
Case "vertifyCode"
a.Value = "1234"
End Select
Next
WebBrowser1.document.getElementById("LoginBtn").Click
这个问题源于弹窗中的登录表单是在iframe中,而WebBrowser控件默认只能访问主框架的document,求助大佬解决:实现获取到iframe的document,完成自动填表?
[此贴子已经被作者于2023-3-22 22:11编辑过]