YasserKhalil
Well-Known Member
Hello everyone
Till now I couldn't get the difference between using IE and XMLHTTP (forgive my ignorance)
Although I have seen multiple threads I still couldn't get it
I have the following code that is working in IE
But when trying to use XMLHTTP method, I encountered an error at this line
Any help in this topic please?
Till now I couldn't get the difference between using IE and XMLHTTP (forgive my ignorance)
Although I have seen multiple threads I still couldn't get it
I have the following code that is working in IE
Code:
Sub Test_Scrape()
Dim post As Object
Dim elem As Object
Dim r As Long
r = 2
With CreateObject("InternetExplorer.Application")
.Visible = False
.navigate "https://whub.io/startups?q=&p=0&is_v=1"
While .Busy = True Or .readyState < 4: DoEvents: Wend
Application.Wait Now + TimeValue("00:00:05")
Set post = .document.getElementById("search-startups-results")
For Each elem In post.getElementsByClassName("ais-hits--item")
Cells(r, 1).Value = elem.getElementsByTagName("span")(0).innerText
Cells(r, 2).Value = elem.getElementsByTagName("a")(0).href
r = r + 1
Next elem
End With
End Sub
But when trying to use XMLHTTP method, I encountered an error at this line
Code:
For Each elem In post.getElementsByClassName("ais-hits--item")
Any help in this topic please?