从单页Web应用程序中删除Vba Web


大家好,有人能帮我吗我必须在InputBox中输入一些值,然后单击"搜索"按钮。根据这一点,InputBox值数据显示在同一页面中,而不更改其URL。我做了一个代码,在输入框中放入一个值,但当代码点击搜索按钮时,弹出窗口显示输入框为空

检查输入框的元件

<input id="u_edi_claim_key0" placeholder="" ng-model-options="{ allowInvalid: true }" name="u_edi_claim_key0" type="text" class="form-control input-sm ng-valid ng-valid-maxlength ng-touched ng-dirty ng-valid-parse ng-empty" ng-model="searchController.Obj[tab.id+':'+data.displayID]" capitalize="u_fln_dcc">

检查SearchButton 的元素

<button type="submit" id="Search" class="btn btn-primary btn-sm ng-binding" data-toggle="tooltip" ng-click="searchController.performSearch()" ng-disabled="searchController.callInProgress || searchController.searchForm.u_edi_claim.$invalid" title="Click this button to perform the search.">

Sub macro()
Dim a As String
Dim IE As InternetExplorerMedium
Set IE = New InternetExplorerMedium
Dim Ist As IHTMLElementCollection
Dim i As IHTMLElement
IE.Visible = True
a = "https://doc30-ui.uhg.com/doc30-ui/search"
IE.navigate a

Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
Application.Wait Now + TimeValue("00:00:3")

Dim DOC  As New HTMLDocument
Set DOC = IE.document
Set Ist = DOC.getElementsByTagName("input")
For Each i In Ist
If i.ID = "u_edi_claim_key0" Then
i.Focus
i.Select
i.Value = 66827839
End If
DOC.getElementById("Search").Click
Next
MsgBox "done"
End Sub
Sub macro()
Dim a As String
Dim IE As InternetExplorerMedium
Set IE = New InternetExplorerMedium
Dim Ist As IHTMLElementCollection
Dim i As IHTMLElement
IE.Visible = True
a = "https://doc30-ui.uhg.com/doc30-ui/search"
IE.navigate a

Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop
Application.Wait Now + TimeValue("00:00:3")

Dim DOC  As New HTMLDocument
Set DOC = IE.document
Set Ist = DOC.getElementsByTagName("input")
For Each i In Ist
If i.ID = "u_edi_claim_key0" Then
i.Focus
i.Select
i.Value = 66827839
Exit For
Application.Sendkeys "~"
End If

Next
Application.Sendkeys "~"
MsgBox "done"
End Sub

最新更新