参考html元素

时间:2018-05-31 17:59:51

标签: vba

你能告诉我这段代码有什么问题:

Public Sub GetInfo()
    Dim IE As Object, html As Object

    With CreateObject("InternetExplorer.Application")
        .Visible = True
        .navigate "https://pl.pons.com/tłumaczenie"

        While .Busy Or .readyState < 4: DoEvents: Wend

        Set html = CreateObject("htmlfile")
        Set html = .document

        With html

            .getElementsByTagName("span")(22).Click
            .getElementsByTagName("span")(109).Click
            .getElementByID("q").Value = "rower"
            .querySelector("button.btn.btn-primary.submit").Click
            Application.Wait Now + TimeSerial(0, 0, 3)
            translation = .getElementsByTagName("dd")(0).innerText

            Stop
        End With
        .Quit
    End With

End Sub

它有效,但翻译什么也没有。我使用后期绑定,我无法改变它。

0 个答案:

没有答案