florentbr / SeleniumBasic

A Selenium based browser automation framework for VB.Net, VBA and VBScript
BSD 3-Clause "New" or "Revised" License
431 stars 197 forks source link

Selenium Basic VBA error Run-time error '0' - WebRequestError - The underlying connection was closed. An unexpected error occurred on a recieve #228

Open JamesDean95 opened 3 years ago

JamesDean95 commented 3 years ago

Hi All,

The error in the sub is what i keep getting when I try to use selenium on excel. This happens and all i've done is the below as a test;

sub Test1() Dim ch as Selenium.Chromedriver

Set ch = new selenium.chromedriver ch.start ch.get "www.google.com"

end sub

I have checked the chrome driver - multiple times I am using version 94 64 bit chrome and thus downloaded the equivalent chrome driver from chromium. Sometimes it installs fine and I can add to the selenium basics folder. Othertimes i add it and then it disappears.

When the chromedriver.exe file is in the seleniumbasic folder which is located in user/appdata/local I run the code after setting the reference to the library and get the error.

I also get an error to say it was unable to call the program within 15s. And 2 cmd windows withthe filepath location to chrome.exe open up but are blank.

I have .net framework 3.5 installed and activated and i still cannot use this.

I have a work laptop on windows 7 - everything i installed the same yet it works fine on there for me?

Gby3 commented 3 years ago

Hi James! The default path to install SeleniumBasic is fine as it is, so leave it like that (user/appdata/local). Now test your code like this:

Dim ch As New Selenium.ChromeDriver ' (Using early binding instead)

Public Sub Test()

ch.start

ch.get "https://www.google.com" ' Notice here we need to pass the complete URL otherwise wont work

You can find info like this and other useful stuff in the example worksheets contained inside (user/appdata/local)

Hope it helps!