[英]clicking next button with excel macro
我正在尝试让宏在 Internet Explorer 中打开一个页面,输入登录信息,单击登录,然后在下一页上,单击“我同意”。 这是我到目前为止所拥有的。
Sub Test1()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
IE.navigate "website.com"
Do While IE.Busy
Application.Wait DateAdd("s", 1, Now)
Loop
Dim idoc As MSHTML.HTMLDocument
Set idoc = IE.document
idoc.all.orgCode.Value = "****"
idoc.all.UserName.Value = "****"
idoc.all.Password.Value = "****"
Dim ele As MSHTML.IHTMLElement
Dim eles As MSHTML.IHTMLElementCollection
Set eles = idoc.getElementsByTagName("input")
For Each ele In eles
If ele.Value = "Login" Then
ele.Click
Else
End If
Next ele
End Sub
这足以让我进入需要点击“我同意”的页面,但我不确定如何让它点击“我同意”按钮。
这是检查元素下出现的内容
谁能帮我下一步做什么?
Next ele Do While IE.Busy Application.Wait DateAdd("s", 1, Now) 循环设置 eles = idoc.getElementsByTagName("input")
For Each ele In eles
If ele.Value = "I Agree" Then
ele.Click
Else
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.