dimanche 1 août 2021

Scraping Data from Website using vba doesn´t work

I want to create a list of player names scraping a website. The Internet Explorer starts but I get an run time error "438" - Object does not support this property or method.

Structure of webpage

Structure of webpage

My coding is as follows:

Option Explicit

Sub Playernames()

Dim IE As New SHDocVw.InternetExplorer
Dim HTMLdoc As MSHTML.HTMLDocument
Dim HTMLPlayers As MSHTML.IHTMLElementCollection
Dim HTMLPlayer As MSHTML.IHTMLElement

IE.Visible = True
IE.Navigate "https://play.kickbase.com/transfermarkt/kaufen"

Do While IE.ReadyState <> READYSTATE_COMPLETE
Loop

Application.Wait (Now + TimeValue("0:00:10"))

Set HTMLdoc = IE.Document

Set HTMLPlayers = HTMLdoc.getElementsByClassName("players")

'In the following line the degbugger shows an error
For Each HTMLPlayer In HTMLPlayers.getElementsByTagclassname("firstName")
Debug.Print HTMLPlayer.className, HTMLPlayer.tagName, HTMLPlayer.innerText

Next HTMLPlayer

End Sub



Aucun commentaire:

Enregistrer un commentaire