How to install Selenium for Windows and use Chrome with Excel VBA. Watch the video below:
How to Install Selenium for Windows
(1) Uninstall Any Previous Installation of Selenium
(2) Check Your Chrome Version by –
(a) Going to Help
(b) About Google Chrome
(c) You would see something like that Version 96.0.4664.45 (Official Build) (64-bit)
(3) Download the Latest Version of Selenium
(4) Download the ChromeDriver
(a) Make sure of the version that suits your chrome version.
For example for my version 96.0.4664.45 (Official Build) (64-bit)
The suitable ChromeDriver is:
chromedriver_win32.zip 2021-11-16 09:36:00 5.80MB b1c93546ea5f304a9e7ac8b3944af7d
(5) Install SeleniumBasic
(6) Next Unzip the chromedriver file chromedriver_win32.zip
(7) Copy the chromedriver.exe to the path of Selenium
Path – C:\Users\%username%\AppData\Local\SeleniumBasic
Now test Proper Working of Selenium
(a) Open a new blank Excel file
(b) Press Alt + F11 to Open Visual Basic Editor
(c) Select Tools
(d) Select References
(e) Check box next to Selenium Type Library
(f) Click OK
Run Code Snippet Below:
Dim driver As New WebDriver
Private Sub CommandButton1_Click()
Dim keys As New SeleniumWrapper.keys
driver.SendKeys (“Today’s financial news”)
What is Selenium? Selenium is a range of tools and libraries that enable and support the automation of web browsers.
We can make the use of Selenium Software less complicated by using the SeleniumWrapper software along with it:
Techopedia explains Wrapper in the following manner:
“In the context of software engineering, a wrapper is defined as an entity that encapsulates and hides the underlying complexity of another entity by means of well-defined interfaces. Patterns and frameworks form an integral component of software engineering. A wrapper pattern is a class with a special interface that allows incompatible classes to work together. Two classes may not be able to perform a data transfer due to the presence of incompatible data access points. For example, if a class accepts a date in DD/MM/YY format from another class that generates a date in MM/DD/YYYY format, neither of the classes can coexist to operate as an integrated module because their data formats are different. The wrapper class solves this problem by converting the data into a compatible format.”
We can download SeleniumWrapper Software from here.
Watch the video on how to use the SeleniumWrapper Software.
In the next video we will learn how to enter data into a multiple form of a web page using Selenium and SeleniumWrapper libraries with Excel VBA.