我正在尝试点击第一个Ref number182931"请求ID"350-老化副本";只有在两个报告中,我尝试在excelVBA &我尝试了很多方法,但没有发生任何事情,我附上了两个图像,请检查& &;帮助。
[check this image][1][查看图片][2][1]: https://i.stack.imgur.com/3I311.png[2]: https://i.stack.imgur.com/chrUD.png
Sub VSV_Ageing_Download()
Dim IE As Object
Dim Button
Dim Button2
Dim Button3
Dim objShell
Set objShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
Set IE = CreateObject("InternetExplorer.Application")
IE.Top = 0
IE.Left = 0
IE.Width = 1000
IE.Height = 1050
IE.Visible = 1
IE.navigate "MY link"
Application.Wait Now + TimeValue("00:00:06")
Loop
IE.document.all.Item("username").Value = "xxxxxxxxxxx"
IE.document.all.Item("password").Value = "xxxxxxxxxxx"
Application.Wait Now + TimeValue("00:00:06")
Do While IE.Busy
Loop
For Each Button2 In IE.document.getElementsByTagName("input")
If Button2.Type = "submit" Then
Button2.Click
Exit For
End If
Next
Application.Wait Now + TimeValue("00:00:06")
Do While IE.Busy
Loop
For Each MYCELLS In Rng
IE.document.all.Item("circleId").Value = "my data"
IE.document.forms(4).submit
For Each Button2 In IE.document.getElementsByTagName("input")
If Button2.Value = "Go" Then
Button2.Click
Exit For
End If
Next
Application.Wait Now + TimeValue("00:00:06")
Do While IE.Busy
Loop
For Each Button2 In IE.document.getElementsByTagName("input")
If Button2.Value = "Request Management" Then
Button2.Click
Exit For
End If
Next
Application.Wait Now + TimeValue("00:00:06")
Do While IE.Busy
Loop
For Each Button2 In IE.document.getElementsByTagName("input")
If Button2.Value = "Monitor Request Status" Then
Button2.Click
Exit For
End If
Next
Application.Wait Now + TimeValue("00:00:06")
Do While IE.Busy
Loop
IE.document.all.Item("loginId").Value = "my id"
IE.document.forms(5).submit
Application.Wait Now + TimeValue("00:00:03")
Do While IE.Busy
Loop
'i am stuck at below code kindly help on this
For Each Button2 In IE.document.getElementsByTagName("a")
If Button2.Title = "Click Here to Download the Report" Then
Button2.Click
Exit For
End If
Next
Application.Wait Now + TimeValue("00:00:01")
Do While IE.Busy
Loop
Next
End Sub
请帮忙。
thanks in advance
我会避免循环并使用css选择器列表查找图像中显示的td并使用class匹配。然后移动到子锚标记,它将使用子组合符(>)作为直接子锚标记进行匹配。
另外,我将指定子锚标记必须有一个包含字符串"Download the Report"(区分大小写):
IE.document.querySelector("td.tableDataFont > a[title*='Download the Report']").click
不需要循环。