Selenium Will Not Start

hicksi

Board Regular
Joined
Mar 5, 2012
Messages
214
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I am having some difficulty making my Excel VBA connect to the Web using Selenium.
I have downloaded and installed SeleniumBasic-2.0.9.0.exe
I am using Microsoft® Excel® 2019 MSO (Version 2207 Build 16.0.15427.20182) 64-bit (that piece of information took some time to find, not like in the old days of Help/About)
My VBA Developer appears to be Retail 7.1.1124 (that is in Help/About)
My VBA References includes 'Selenium Type Library' sourced from .\...\...\SeleniumBasic\Selenium64.tlb

VBA Code:
Sub Sample3()
Dim driver As New WebDriver
    With driver
        .Start "Chrome"
        .Get "google.com"
    End With
    Stop
End Sub

When I run it, the .Start "Chrome" results in a timeout error:
1659941680526.png

Yet Chrome is installed and I can run it:- Version 104.0.5112.81 (Official Build) (64-bit)

Similarly, if I attempt to .Start "FireFox":
1659941779944.png

... At least an instance of FireFox displays, but doesn't appear to properly initialise.
Version 103.0.1 (64-bit)

and .Start "Edge":
1659941851613.png

My installation of Edge:- Version 104.0.1293.47 (Official build) (64-bit)

Has anyone had this issue, and what is the resolution?
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
I wrote a quick guide re: installing Selenium here - from your explanation above, I'm wondering whether you also downloaded/installed ChromeDriver? You will need to driver for the relevant Browser, and as set out in the instructions, the key point is that you need to make sure that the version of ChromeDriver you're using matches the version of Chrome you're trying to use.
Hope that helps, but let me know if you're still having difficulty with it.
 
Upvote 0
Solution
Yep. I got it to start under Chrome when I downloaded the 'correct' drivers. And it WAS something from Owl that alerted me to the requirement, including copying the EXE into the Selenium folder..
Not entirely sure why I would need it, but I also downloaded and installed seleniumwrappersetup-1.0.17.0.exe.
And I included both 'Selenium Type Library' and 'Selenium Wrapper Type Library' in my References.

Now comes the fun bit of getting it to select the data from the page.
It would be WONDERFUL if these open-source things kept up-to-date with their instructions (on installing, and on usage). Selenium isn't alone in this.

I wonder what I need to make Edge or IE or Facebook work. But hey, if I can get one to function, I'm happy.
 
Upvote 0
Well, funny you should mention it... kinda topical at the moment.
IE is staggeringly easy to get working - VBA + IE = a dream to use.. save for the fact that MS keeps pulling the plug on all of it's products, and leaves VBA users high and dry without a replacement..., or so they say. Internet Explorer is theoretically gone (as of 15 June), but you can still use the web browser control in VBA. Also, interestingly, MS have a development roadmap for Office products, and they area apparently producing a new Edge-compatible webbrowser control to be released next month.... in theory. It's currently a year or two late, I think, and what's more - according to the Road Map, it's only for Access users. I don't quite understand why/how that should be the case, but oh well. There is also a project on Github that allows VBA to connect with Chrome direct - no drivers, no selenium, etc. I haven't had a chance to sit down and work it all out yet though. It still needs a bit of work.

But anyway - there are a whole lot of different things being worked on, and there will definitely be some sort of solution out there for you, but see how you go with Selenium and let me know if you're not having much luck.
 
Upvote 0
Yeah. VBA is the COBOL of the new millennium. So much of it out there, but the development world has left it behind like the Ford Model-T.
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top