0

I need to switch from ie to xmhttp60, and get the result of the execScript. Is there any way to do it? Below the code I'm using.

Sub MostrarMasButton()

    Dim ie As InternetExplorer
    Dim CurrentWindow As HTMLWindowProxy

    url = "https://es.investing.com/equities/amazon-com-inc-earnings"

    Set ie = New InternetExplorer
    
    ie.Visible = True
    ie.navigate url
    
    Do While ie.Busy = True Or ie.readyState <> 4: DoEvents: Loop
    ie.document.parentWindow.execScript ("showMoreEarningsHistory(6435, this)")
             
End Sub
  • XmlHttpRequest objects cannot execute JavaScript, only browsers do that. (If `showMoreEarningsHistory()` issues an Ajax request then that's what you would need to invoke with an XmlHttpRequest) – Alex K. Oct 13 '20 at 13:40
  • @Alex K, I've seen in the dev tools->Network tab there is actually an XHR with an Ajax issued. but honestly I don't know how to use it. The URL it shows seems to be dynamic and I need to run this same sequence for all the stocks not just for amazon. I'm really stuck at this point. I've opened a question [link](https://stackoverflow.com/questions/64288496/vba-scraping-with-javascript-troubles-to-use-execscript) which show what I need, but I haven't received any positive answer. Any help will be much appreciated. – Mike Hillflag Oct 13 '20 at 16:04
  • From the description of this thread and from the description of the referenced thread, I understand that you want to click the click the **Mostrar más** button until it displays all the table data. I suggest you refer to this [example](https://freetexthost.net/pNqKoWKz). Try to run it on your side and let us know whether it is working or not. – Deepak-MSFT Oct 14 '20 at 06:43
  • Hi Deepak, I'm not using iE but XMLHTTP. Please refer to this [link] (https://freetexthost.net/OyWkqrGY) to see exactly what Im looking for. – Mike Hillflag Oct 14 '20 at 12:27

0 Answers0