Html 单击末尾的“图元值”

Html 单击末尾的“图元值”,html,excel,vba,web-scraping,Html,Excel,Vba,Web Scraping,系统接受getelementbyid值,但如果单击该框,它允许登录 我想登录网页“”,但该网站只接受键盘输入值 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 =

系统接受getelementbyid值,但如果单击该框,它允许登录

我想登录网页“”,但该网站只接受键盘输入值

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
Dim ie作为对象
设置ie=CreateObject(“InternetExplorer.Application”)
即“导航”https://www.connect2nse.com/MemberPortal/home.jsp"
而ie.readyState 4:DoEvents:Wend
可见=真实
ie.document.getElementById(“用户id”).Value=“1234ABC”
ie.document.getElementById(“成员代码”).Value=“1234”
ie.document.getElementById(“密码”).Value=“5678”
作为字符串的Dim VAL
VAL=InputBox(“输入验证码值”、“验证码”和“”)
如果VAL=”“,则
终点
如果结束
ie.document.getElementById(“loginCap”).Value=(VAL)
ie.document.getElementById(“ext-gen39”)。单击
如果用户ID、成员代码、密码和验证码是用键盘输入的,或者用鼠标点击该框,则系统启用提交按钮


如何通过VBA实现这一点你需要首先关注元素

ie.document.getElementById("loginCap").Focus
ie.document.getElementById("loginCap").Value = VAL
我可以建议您使用

If VAL = vbNullString Then Exit Sub 
而不是当前使用
End
If
语句

另外,使用适当的页面加载等待

While ie.Busy Or ie.readyState < 4: DoEvents: Wend
当ie.Busy或ie.readyState<4:DoEvents:Wend时
我不知道用vba读取验证码的方法。您可以尝试使用python和一种用于python的光学字符识别(OCR)工具。也就是说,它将识别并“读取”嵌入图像中的文本。有一些服务提供此验证码解决方案,您可以使用vba(在访问和返回响应方面)自动进行验证码解决。我正在使用Inputbox插入验证码,但仅建议为什么提交框不启用静态值,即存在ie.document.getElementById(“用户id”).value=“1234ABC”ie.document.getElementById(“成员代码”).Value=“1234”ie.document.getElementById(“密码”).Value=“5678”它使用键盘值…忽略验证码部分作为旁白:我建议您使用If VAL=vbNullString安全退出代码,然后退出Sub,而不是使用End的当前If语句。另外,在ie.Busy或ie.readyState<4:DoEvents:Wendle时使用适当的页面加载等待。我应该如何启用提交按钮?。当我手动输入它时,它将启用,但以编程方式它不会启用