系统采取的getElementById价值,但它允许如果我们点击那个框登录
我想登录网页“https://www.connect2nse.com/MemberPortal/home.jsp”,但网站只需要键盘输入值
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "https://www.connect2nse.com/MemberPortal/home.jsp"
While ie.readyState <> 4: DoEvents: Wend
ie.Visible = True
ie.document.getElementById("user_id").Value = "1234ABC"
ie.document.getElementById("member_code").Value = "1234"
ie.document.getElementById("password").Value = "5678"
Dim VAL As String
VAL = InputBox("Enter Captcha Value", "CAPTCHA", "")
If VAL = "" Then
End
End If
ie.document.getElementById("loginCap").Value = (VAL)
ie.document.getElementById("ext-gen39").Click
系统使提交按钮,如果用户名,会员编号,密码和验证码使用键盘输入或点击鼠标那个盒子
如何通过VBA做
你需要关注的元素第一
ie.document.getElementById("loginCap").Focus
ie.document.getElementById("loginCap").Value = VAL
我建议你安全地使用退出代码
If VAL = vbNullString Then Exit Sub
而不是当前的If
声明它采用End
。
同时,使用合适的页面加载等待
While ie.Busy Or ie.readyState < 4: DoEvents: Wend