单击末尾的元素值 [英] Click Element value at end
问题描述
系统采用getelementbyid值,但如果我们单击该框,则允许登录
我想登录网页" https://www.connect2nse.com/MemberPortal/home.jsp ",但网站仅接受键盘输入值
Dim即作为对象设置ie = CreateObject("InternetExplorer.Application")即浏览"https://www.connect2nse.com/MemberPortal/home.jsp"而ie.readyState<>4:DoEvents:Wendie.Visible = Trueie.document.getElementById("user_id").Value ="1234ABC"ie.document.getElementById("member_code").Value ="1234"ie.document.getElementById("password").Value ="5678"昏暗的VAL作为字符串VAL = InputBox(输入验证码值","CAPTCHA",")如果VAL ="然后结尾万一ie.document.getElementById("loginCap").Value =(VAL)ie.document.getElementById("ext-gen39").点击
如果使用键盘输入用户名,会员代码,密码和验证码,则系统启用提交"按钮.
如何通过VBA进行操作
您需要首先关注元素
ie.document.getElementById("loginCap").焦点ie.document.getElementById("loginCap").Value = VAL
我可以建议您使用
安全地退出代码吗? 如果VAL = vbNullString然后退出Sub
而不是您当前使用 End
的 If
语句.
另外,使用适当的页面加载,等待
同时为忙"或"readyState"<4:DoEvents:Wend
System taking getelementbyid value but it allow to login if we click at that box
I wanted to log in web page "https://www.connect2nse.com/MemberPortal/home.jsp" but site takes keyboard input values only
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
System enables Submit button if UserID, Member Code, Password and Captcha entered using keyboard or click on that box by mouse
How to do it by VBA
You need to focus on the element first
ie.document.getElementById("loginCap").Focus
ie.document.getElementById("loginCap").Value = VAL
May I suggest you safely exit your code by using
If VAL = vbNullString Then Exit Sub
rather than your current If
statement which uses End
.
Also, use a proper page load wait with
While ie.Busy Or ie.readyState < 4: DoEvents: Wend
这篇关于单击末尾的元素值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!