在将加载号输入网站的文本框后,我无法让代码点击按钮。我一直在
错误91
在.all("btn btn-primary").Click
网站上的按钮代码:
<div class="submit-section">
<button class="btn btn-primary" type="submit" data-ng-disabled="vm.loadingTracking">
<!-- ngIf: !vm.loadingTracking --><span class="ng-scope" data-ng-if="!vm.loadingTracking">Track shipments</span><!-- end ngIf: !vm.loadingTracking -->
<!-- ngIf: vm.loadingTracking -->
</button>
</div>
我的代码:
Dim IE As InternetExplorer
Dim HTMLdoc As HTMLDocument
Dim URL As String
Dim loadNumberCells As Range
Dim traceNumbers As String
Dim resultsDiv As HTMLDivElement
Dim resultsTable As htmltable, infoTable As htmltable
Dim infoTables As IHTMLElementCollection
Dim i As Long
Dim result As String
Dim ProNumber As String, ProNumberRow As Variant
'Get pickup numbers from column A in 1st sheet starting at A2
With Worksheets(1)
Set loadNumberCells = .Range("A2", .Cells(Rows.Count, "A").End(xlUp))
End With
loadNumberCells.Offset(, 1).ClearContents
traceNumbers = Join(Application.Transpose(loadNumberCells), vbNewLine)
URL = "https://arcb.com/tools/tracking.html"
'Get existing IE window open at page, if any
'Set IE = Get_IE_Window2(URL)
If IE Is Nothing Then Set IE = New SHDocVw.InternetExplorer
With IE
.Visible = True
'SetForegroundWindow .Hwnd
.navigate URL
While .Busy Or .ReadyState <> READYSTATE_COMPLETE: DoEvents: Wend
Set HTMLdoc = .Document
End With
With HTMLdoc
'Put trace numbers in input box and click Trace
.all("trackingNumbers").Value = traceNumbers
.all("btn btn-primary").Click
While .ReadyState <> "complete": DoEvents: Wend
End With
IE.Visible = True