selenium vba chrome automation

In below video, I have teach you how to automate Google Chrome from Excel VBA. As you know, we can do automation using VBA in Excel. But we can’t automate Chrome browser from VBA without third party library.

I have refer selenium library to automate chrome. Selenium is one of the most popular automation tool for testing and Web Scraping. It is completely Free and easy to use in VBA projects.

In this tutorial, I have use selenium Basic to open Chrome and will open multiple tabs so you can work on multiple websites at the same time. I have share you my VBA code as:

Sub Multitab()
Dim Chrome As WebDriver
Set Chrome = New ChromeDriver
Const URL = "https://google.com/"

With Chrome
    .Start "Chrome"
    .Window.Maximize
    .Get URL
    .Wait 500
    .ExecuteScript "window.open('https://web.whatsapp.com/','_blank');"
    .Wait 500
    .ExecuteScript "window.open('https://www.facebook.com/','_blank');"
    .Wait 500
    .ExecuteScript "window.open('https://www.instagram.com/','_blank');"
    .Wait 500
    .ExecuteScript "window.open('https://www.linkedin.com','_blank');"
    .Wait 500
    .ExecuteScript "window.open('https://99excel.com/','_blank');"
    .Wait 500
    
    .SwitchToPreviousWindow
    .Wait 500
End With
MsgBox "Done"
End Sub