Title: Can't fetch the titles from a webpage
Tags: vba;excel;web-scraping;internet-explorer-11
Question: I've written a script in vba in combination with IE to get the titles of diferent charts from a webpage but I'm not being able to. It seems I've used right class names along with tag names to reach the content but no dice. It doesn't throw any error either.
This is my approach so far:
Sub GetTitle()
Const Url As String = "https://www.fbatoolkit.com/"
Dim IE As New InternetExplorer, Html As HTMLDocument
Dim post As Object
With IE
.Visible = True
.navigate Url
While .Busy = True Or .readyState < 4: DoEvents: Wend
Set Html = .document
End With
Application.Wait Now + TimeValue("00:00:05")
For Each post In Html.getElementsByClassName("chart")
With post.getElementsByTagName("text")
If .Length Then R = R + 1: Cells(R, 1) = .item(0).innerText
End With
Next post
End Sub
The titles are like below which are visible above each charts:
Toys &amp; Games
Health &amp; Household
I'm not expecting any solution related to selenium. Thanks.

Here is the accepted answer: This is a bit of cheat to be honest. Consider it a placeholder until I find a better way as I am guessing you specifically want to access those titles.
Option Explicit
Public Sub GetInfo()
Dim ie As New InternetExplorer, html As HTMLDocument, titles(), i As Long
With ie
.Visible = True
.navigate "https://www.fbatoolkit.com/"
While .Busy Or .readyState < 4: DoEvents: Wend
Set html = .document
titles = GetTitles(html.body.innerHTML, "id=""visualization([^""]*)")
For i = LBound(titles) To UBound(titles)
Debug.Print titles(i)
Next
.Quit '<== Remember to quit application
End With
End Sub
Public Function GetTitles(ByVal inputString As String, ByVal sPattern As String) As Variant
Dim Matches As Object, iMatch As Object, s As String, arrMatches(), i As Long
With CreateObject("vbscript.regexp")
.Global = True
.MultiLine = True
.IgnoreCase = True
.Pattern = sPattern
If .test(inputString) Then
Set Matches = .Execute(inputString)
For Each iMatch In Matches
If iMatch.SubMatches(0) <&gt; vbNullString Then
ReDim Preserve arrMatches(i)
arrMatches(i) = Replace$(Replace$(iMatch.SubMatches(0), Chr$(95), Chr$(32)), Chr$(32) &amp; Chr$(32), Chr$(32) &amp; Chr$(38) &amp; Chr$(32))
i = i + 1
End If
Next iMatch
End If
End With
GetTitles = arrMatches
End Function
Comment for this answer: Thanks @QHarr, for your suggestion. I didn't notice that I could have patsed `ids` to get the titles. How come I missed them!!
Comment for this answer: Okay, now we can delete commnts. I will paste here a link how I optimozed If you like. Once again `I + lrow` did the trick.

Here is another answer: Althogh this answer is fully influenced by QHarr, I thought to publish it for future readers. Making use of IDS is the best policy here. The following solution almost resembles the category names.
Here it is:
Sub GetChartInfo()
Const Url As String = "https://www.fbatoolkit.com/"
Dim IE As New InternetExplorer, Html As HTMLDocument
Dim itemvisibility As Object, otitle As Object, I&amp;
With IE
.Visible = False
.navigate Url
While .Busy = True Or .readyState < 4: DoEvents: Wend
Set Html = .document
End With
Do: Set itemvisibility = Html.querySelectorAll("div[class='chart-container']"): DoEvents: Loop While itemvisibility.Length <= -1
With Html.querySelectorAll("div[class='chart-container']")
For I = 0 To .Length - 1
Do: Set otitle = .Item(I).querySelector(".chart"): DoEvents: Loop While otitle Is Nothing
Cells(I + 1, 1) = Application.WorksheetFunction.Proper(Replace(Replace(Split(otitle.getAttribute("id"), "visualization_")(1), "__", " "), "_", " "))
Next I
End With
End Sub
Comment for this answer: Nice way of doing

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:07/29/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<vba><excel><web-scraping><internet-explorer-11>', 'Title': "Can't fetch the titles from a webpage", 'ViewCount': 72, 'id': 51579827, 'user_AboutMe': '<p>Hi there!!! Nice to meet you. This is Md. Shahin Iqbal. I\'m not from any technical background, yet I love to code mainly because it is fun and vivifying. I\'m deeply passionate about practising clean code. You can find me on <a href="https://www.upwork.com/freelancers/%7E013367c0f4b1ebe2bb" rel="nofollow noreferrer">Upwork</a> and also on <a href="https://www.linkedin.com/in/md-shahin-iqbal/" rel="nofollow noreferrer">LinkedIn</a>.</p>\n', 'user_AccountId': 10394386.0, 'user_DisplayName': 'SIM', 'user_Reputation': 21638.0, 'user_Views': 2790.0, 'user_id': 9189799.0}}