UPS自动跟踪点击一个button

我想访问网页 。 然后在testing框中input一个数字。 我能做到这一点。

之后,我想点击跟踪button。 任何想法如何可以点击通过VBA?

我已经尝试了下面的命令。 任何想法如何find跟踪button的ID?

ie.document.getElementByName("track.x").Click ie.document.getElementByClass("button btnGroup6 arrowIconRight").Click 

让我们input跟踪号码“1ZW2E2360449018801”,一旦我点击那个button,一个新的网页打开。 我想点击“发货进度”栏并复制出现的表格。 有什么build议么?

这将完成..

 Sub test() ' open IE, navigate to the website of interest and loop until fully loaded Set ie = CreateObject("InternetExplorer.Application") my_url = "http://wwwapps.ups.com/WebTracking/track?loc=en_US" With ie .Visible = True .navigate my_url .Top = 50 .Left = 530 .Height = 400 .Width = 400 Do Until Not ie.Busy And ie.readyState = 4 DoEvents Loop End With ' Enter a value in the "Number" text box ie.Document.getElementById("trackNums").Value = "1ZW2E2360449018801" ' Click the "Submit" button Set Results = ie.Document.getElementsByTagName("input") For Each itm In Results If InStr(1, itm.outerhtml, "Track", vbTextCompare) > 0 Then itm.Click exit for End If Next ' Click the "Shipment Progress" button Set Results = ie.Document.getElementsByTagName("h4") For Each itm In Results If InStr(1, itm.outerhtml, "Shipment Progress", vbTextCompare) > 0 Then itm.Click exit for End If Next ' Get the text from the "Shipment Progress Table" and assign to a variable tbltxt = ie.Document.getElementsByTagName("table")(4).innertext ' process the text as desired End Sub 

像这样的东西应该工作:

 ie.document.getElementsByName("track.x")(0).Click 

注意它是getElement * s * ByName,所以它返回一个集合,而不是一个元素。