Clicking a refresh button on a web page

290 Views Asked by At

I'm able to scrape data but I don't know how to click a refresh button.

On the web page it's the button that says Osvježi.

This is the web page : https://zse.hr/default.aspx?id=10006&dionica=1027

This is the Html line:

<input type="submit" value="Osvježi" class="btnSubmit2">

This is the picture of the HTML code
enter image description here

This is VBA code:

Sub zse()
    
    Dim ie As InternetExplorer, htmle As IHTMLElement
    Dim i As Integer
    
    i = 1
    
    Set ie = New InternetExplorer
    ie.Visible = True
    ie.navigate "https://zse.hr/default.aspx?id=10006&dionica=259"
    
    Do While ie.Busy = True Or ie.readyState <> READYSTATE_COMPLETE
        Application.Wait Now + TimeValue("00:00:02")
    Loop
    
    ie.document.getElementById("DateFrom").Value = "1.1.2010"
    ie.document.getElementsByClassName ("btnSubmit2")
    
    Debug.Print ie.document.getElementById("btnSubmit2")
    
    For Each htmle In ie.document.getElementsByClassName("standard-table sorttable")(0).getElementsByTagName("tr")
    
        With ActiveSheet
            .Range("a" & i).Value = htmle.Children(0).textContent
            .Range("b" & i).Value = htmle.Children(1).textContent
            .Range("c" & i).Value = htmle.Children(2).textContent
            .Range("d" & i).Value = htmle.Children(3).textContent
            .Range("e" & i).Value = htmle.Children(4).textContent
            .Range("f" & i).Value = htmle.Children(5).textContent
            .Range("g" & i).Value = htmle.Children(6).textContent
            .Range("h" & i).Value = htmle.Children(7).textContent
            .Range("i" & i).Value = htmle.Children(8).textContent
            .Range("j" & i).Value = htmle.Children(9).textContent
            .Range("k" & i).Value = htmle.Children(10).textContent
         
        End With
        i = i + 1
    Next htmle
    
End Sub
0

There are 0 best solutions below