2

I was running the following code without a problem on a machine with excel 2013. We recently upgraded to Excel 2019 and the macro now returns an Automation error. I noticed that the error seems to be in the driver.start section , it looks like it's not 'registering' the reference. I have reinstalled the Selenium add-in , re-pointed the reference, tried different browsers ( chrome, edge etc) but to no avail .

Dim driver As New WebDriver
Dim keyObj As Selenium.keys
Dim IE As Object

Set keyObj = New Selenium.keys

driver.Start "ie"
driver.Window.Maximize
driver.Get "https://www.google.com/"

Any suggestions/ ideas would be much appreciated.

1
  • tried all the suggestions and failed, until I install .NET 3.5 SP1 Commented Aug 26, 2021 at 13:32

7 Answers 7

8

I was able to fix this by installing MS .Net framework 3.5 (Selenium requires)

Sign up to request clarification or add additional context in comments.

Comments

6

enter image description hereTry adding Selenium to references (Selenium Type Library).

It solved the error for me.

When you installed Selenium you checked the drivers? enter image description here

If you are using Chrome, have you downloaded the same version of chrome driver as your chrome browser version?

First of all, go to control panel and uninstall previous installation of selenium and then follow the steps 1- Download the latest version of chrome and make sure of the version of Chrome from Help >> About Google Chrome. You would see something like that Version 75.0.3770.142 (Official Build) (32-bit)

2- Download the latest version from the LINK

3- Download the chromedriver from the follwoing LINK Make sure of the version that suits your chrome version As for the Google Chrome version I posted the most suitable version of chromedriver is ChromeDriver 75.0.3770.140

Now setup SeleniumBasic >> After setup unzip the chromedriver file chromedriver_win32.zip and copy the chromedriver.exe to the path of selenium Here's two possibilties: First >> C:\Program Files\SeleniumBasic Second >> C:\Users%username%\AppData\Local\SeleniumBasic Copy the chromedriver.exe to the SeleniumBasic path

Open new blank excel file >> Press Alt + F11 (Visual Basic Editor) >> Tools >> References >> Selenium Type Library

Insert new module and paste the following code to test

Sub Test()
    Dim sel As New WebDriver
    
    sel.Start "chrome", "https://www.google.com"
    sel.Get "/"
    Stop
End Sub

Comments

4

Please install thru StartChrome.vbs under

C:\Users\%username%\AppData\Local\SeleniumBasic\Scripts\

which lead you proper .Net packages.

which is not correct answer to you, but for someone who are wondering how to start solve this issue.

Selenium team already prepared these kind script

1 Comment

Required after fresh install of Windows 11 on a newly built computer. The install only included Net Framework 4.8.x, but selenium would not run until I installed Net Framework 3.5 using that vbs script.
3

I found a solution to the problem by following a suggestion on a similar post. It looks like Selenium requires MS .Net framework 3.5 . As soon as I add it , the Macro started to work. Because it was a new laptop with Excel 2019 on it , I wasn't aware that if the .net framework had been installed. Thank you to every one that made a suggestion

Comments

2

Cody was right on - see above - Find where your selenium is installed and run the script. C:\Users%username%\AppData\Local\SeleniumBasic\Scripts\

Selenium could be in Programs as well.

Comments

1

I was able to fix this by going to where SeleniumBasic was installed and doubleclicking the StartChrome.vbs and downloading the .net framework that was needed next.

Comments

0

I was getting the same error after doing the steps above, but there is a simple solution. Close Excel and reopen after performing the steps above.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.