WebScrapping Tables Using Selenium With Google Chrome (VBA)

How to install Selenium?

Click the below link to know the steps.

https://learnexcelwithsujeet.blogspot.com/2021/05/steps-to-install-and-use-selenium-for.html


Example-1

Sub test()

Dim ch As Selenium.ChromeDriver

Dim ts As Selenium.WebElements

Set ch = New Selenium.ChromeDriver

ch.Start

ch.Get "https://www.indiatoday.in/education-today/gk-current-affairs/story/indian-states-with-highest-population-1358414-2018-10-08"

Set ts = ch.FindElementsByCss("table")

Debug.Print ts.Count

ts(1).AsTable.ToExcel ThisWorkbook.Sheets(1).Range("a1")

End Sub


Comments

Popular posts from this blog

Power Automate - Automatically fetch data from Power BI in to Excel and Send the copy of the Excel file via Email

Function to Paste Excel Range on Outlook Mail Body (In text not image) Function Name - rngHTML()

Separate Text (Characters) & Numbers from Alpha Numeric String Using Formula and Macro (VBA)