IE VBA open web page equal to clicking on first web page link

我的梦境 提交于 2020-01-16 19:45:10

问题


I'm trying to automate filling in a transaction on a series of web pages using Internet Explorer and MS-Access VBA. I've done quite a bit of this, but am stumped on this one pair of pages. I using code like this:

Set htmlDoc = ie.Document
With htmlDoc
    Set e = .getElementById("j_idt31_data")
    If e Is Nothing Then GoTo FileAppeal_Error
    Set elems = e.getElementsByClassName("ui-widget-content ui-datatable-odd ui-datatable-selectable")
    For Each e In elems
        If InStr(1, e.innerText, "Evans ") > 0 Then
            e.Click
            Exit For
        End If
    Next

End with

I start on this page: https://boe.shelbycountytn.gov/eFile/taxrep.xhtml, click on one of the radio buttons on the left, then click on [Submit], which takes me to https://boe.shelbycountytn.gov/eFile/search.xhtml

But I can't figure out how to programmatically get the [Submit] button to succeed. When I programmatically click on it I get a "Tax Rep is Required" error message.

Suggestions greatly appreciated.


回答1:


I did this using selenium basic. Download then add the selenium type library reference.

Option Explicit
Public Sub test()
    With New ChromeDriver
         .Start "Chrome"
         .Get "https://boe.shelbycountytn.gov/eFile/taxrep.xhtml"
         .FindElementByCss("span.ui-radiobutton-icon.ui-icon.ui-icon-blank").Click
         .FindElementByCss("span.ui-button-text.ui-c").Click     
    'other code
    Stop
    .Quit
    End With
End Sub



回答2:


    Dim elems As MSHTML.IHTMLElementCollection, i As MSHTML.HTMLInputElement        
    Set elems = HTMLDocument.getElementsByClassName("ui-icon-blank")
    Set i = elems(1) 'this gets the second option in the list
    i.Click


来源:https://stackoverflow.com/questions/50162375/ie-vba-open-web-page-equal-to-clicking-on-first-web-page-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!