Last active
July 24, 2018 06:38
-
-
Save ganesh092929/815af43adc29c2298615d97d9e5caf44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ScrapeCarDataPt3() | |
Dim IE As InternetExplorer | |
Set IE = CreateObject("InternetExplorer.Application") | |
IE.Visible = True | |
IE.Navigate "https://carousell.com/categories/cars-32/cars-for-sale-1173/" | |
Do While IE.ReadyState <> READYSTATE_COMPLETE: Loop | |
Dim CarListings As IHTMLElementCollection | |
Dim CarListing As IHTMLElement | |
Dim ItemName As IHTMLElementCollection | |
Dim ItemDetails As IHTMLElementCollection | |
Dim ItemDetail As IHTMLElement | |
Set CarListings = IE.Document.body.getElementsByClassName("col-lg-3 col-md-4 col-sm-4 col-xs-6") | |
For Each CarListing In CarListings | |
Set ItemName = CarListing.getElementsByClassName("A-i") | |
Debug.Print ItemName(0).innerText | |
Set ItemDetails = CarListing.getElementsByTagName("dd") | |
For Each ItemDetail In ItemDetails | |
Debug.Print ItemDetail.innerText | |
Next ItemDetail | |
Next CarListing | |
IE.Quit | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment