Web Scraping on Infomoney page

Asked

Viewed 115 times

0

I have the code below that accesses the Infomoney page and selects the All option from the button to return all results. The problem is that it only selects, but does not click to return all quotations.

Sub GetHtmlDocument()
    Dim IE              As New SHDocVw.InternetExplorer
    Dim HTMLDoc         As MSHTML.HTMLDocument
    Dim HTMLOptions     As MSHTML.IHTMLElementCollection
    Dim HTMLOption      As MSHTML.IHTMLElement
    IE.Visible = True
    IE.navigate "https://www.infomoney.com.br/ibovespa"
    Do While IE.ReadyState <> READYSTATE_COMPLETE
    Loop
    Set HTMLDoc = IE.Document
    Set HTMLOptions = HTMLDoc.getElementsByTagName("option") 'É um botão
    For Each HTMLOption In HTMLOptions
        If HTMLOption.innerText = "Todos" Then
            HTMLOption.Selected = True
            Exit Sub
        End If
    Next HTMLOption
End Sub
  • Paulo, you can tell us which link on the site you want to click?

  • 1

    Good morning! On the page specified in the code, is the button (or Combobox) with the name "see 10 items", of the IBOVESPA Wallet. I managed to change to "All". I just can’t click "All" to return all assets.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.