SeleniumBasic icon indicating copy to clipboard operation
SeleniumBasic copied to clipboard

VBA - Selenium - Chromedriver - Run-time error -2146233078

Open luisrossa opened this issue 3 years ago • 12 comments

Hi,

My VBA code stopped working last week after several months working fine.

In short, the error raises when executing driver.start

"Run-time Error '-2146233078 (801315a)':

The source was not found but some or all event logs could not be searched. Inaccessible logs: Security."

Sub Go_Click() Dim Driver As New Selenium.ChromeDriver Set Driver = CreateObject("Selenium.ChromeDriver") Driver.Start Driver.Get "https://www.google.com" Driver.Quit End Sub

Does anyone had the same experience ? Can it be solved ?

Thanks in advance for your help.

Selenium: SeleniumBasic-2.0.9

Chrome Version Versão 88.0.4324.190 (Compilação oficial) (64 bits)

Chromedriver version 88.0.4324.96

luisrossa avatar Mar 04 '21 17:03 luisrossa

Just updated Chrome to Version 89.0.4389.72 (Official Build) (64-bit) and Chromedriver to 89.0.4389.23 and it runs fine.

mogulman52 avatar Mar 04 '21 22:03 mogulman52

Hi, Thanks for your quick answer. I did what you mentioned but I still get the same errror. Any ideias ? Thanks a lot

luisrossa avatar Mar 05 '21 12:03 luisrossa

I really don't know what is causing your specific issue but if it helps, here are some solutions to issues I had in the past:

  1. Usually when installing on a new PC, I always forget to enable .Net 3.5 so this is the first thing I check if I have any issues.

  2. After working fine for a long time, my VBA scripts started failing. I uninstalled and re-installed SeleniumBasic. It was previously installed on a mapped network drive so I installed it locally in the default location. No idea what caused the issue. I doubt it was the mapped drive because it was working before - more likely a dodgy windows update that screwed up some registry setting. But the re-install solved it.

  3. Remember to update Chromedriver whenever a new version of Chrome is installed

Jottie avatar Mar 05 '21 13:03 Jottie

I am struggling with same issue

Excel 2013

Selenium: SeleniumBasic-2.0.9

Chrome Version 91.0.4472.124 (Official Build) (64-bit)

Chromedriver 91.0.4472.101

SebAnt333 avatar Jul 01 '21 03:07 SebAnt333

Sorry to hear that. I could not still solve my issue. I think it has to do with company IT security policies or some bug(s) from Microsoft. I had to remake all my programs in python. A lot of work, but I'm very happy with the result.

luisrossa avatar Jul 01 '21 08:07 luisrossa

Migrating to Python is what I decided to do as well because support for SeleniumBasic is unclear on the long run. I already developed some stuff based on Win32 libs by Marc Hammond to seamlessly call Python modules form VBA. Helpfull to re-engineer some stuff anyway :-)

dornech avatar Jul 01 '21 09:07 dornech

I get the same runtime error from VBA noted by luisrossa (and others around the Web) on Driver.start for both the Edge and Chrome WebDrivers with the Selenium Type Library (Selenium Basic 2.0.9) using VBA under Windows 10 Enterprise 64-bit, Office 2016 64-bit, MS Edge 91.0.864.67 64-bit, Chrome 91.0.4472.124 64-bit, the current matching WebDrivers for Edge and Chrome in the Selenium Basic folder and properly pointed to by the path to them in the Path environment variable as well, and Net Framework 3.5 SP1 installed. SeleniumTypLibrary is a reference for the VBA module with the code.

The Driver may be instantiated and things like Driver.Timeouts.ImplicitWait may be set and read, but Driver.Start "[edge|chrome]" "[some url]" (e.g., "http://www.google.com") fails.

I did not (and do not) have this issue with SeleniumWrapper 1.0.17.0, but, then, it does not support MS Edge (Chromium).

Does anyone have a solution to the runtime error problem?

Thanks, Nick

NDeLancie avatar Jul 12 '21 22:07 NDeLancie

Thanks for your email. I'm sorry that you have the same issue. As I mentioned earlier, in another post, I found a way using Python. I will give a look to SeleniumWrapper 1.0.17.0.

luisrossa avatar Jul 13 '21 09:07 luisrossa

Thanks, Luis.

Unfortunately, it is not feasible for me to use Python for this because my “application” is in VBA, and Selenium Wrapper does not support Edge, which I would like to be able to use.

I did come across TinySeleniumVBA by “uezo”, an all-VBA implementation of the Selenium Web Driver. It has a few things that I can’t yet make work, but it does the trick (for now) in VBA for what I want to do. Here is a link to it GitHub:

https://github.com/uezo/TinySeleniumVBA

               Best,

               

               Nick

From: luisrossa @.> Sent: Tuesday, July 13, 2021 02:11 am To: florentbr/SeleniumBasic @.> Cc: NDeLancie @.>; Comment @.> Subject: Re: [florentbr/SeleniumBasic] VBA - Selenium - Chromedriver - Run-time error -2146233078 (#219)

Thanks for your email. I'm sorry that you have the same issue. As I mentioned earlier, in another post, I found a way using Python. I will give a look to SeleniumWrapper 1.0.17.0.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/florentbr/SeleniumBasic/issues/219#issuecomment-878916976 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AFOK5ZJPRYO2SEHUEDVW4QLTXP7KVANCNFSM4YTTXX7A . https://github.com/notifications/beacon/AFOK5ZI5KTYTJUDD63EOXJTTXP7KVA5CNFSM4YTTXX7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGRRTK4A.gif

NDeLancie avatar Jul 13 '21 15:07 NDeLancie

I think I have solved the problem reported here (and elsewhere on the web) with the Run-time Error -2146233078 (801315a).

The problem occurs, I think, because SeleniumBasic forces its installation in the c:\users[username]\AppData\Local\SeleniumBasic directory (no way to change this on installation so far as I can see), and on many systems, there is a group security policy in effect that restricts execution of .exe and other executables in the user's AppData directory (as a security precaution against malicious executables being installed in AppData).

This can be demonstrated by double clicking one of the web drivers (e.g., chromedriver.exe, edgedriver.exe) in the AppData\Local\SeleniumBasic directory and seeing if it is blocked or a command window opens indicating its instantiation.

Unless a user can remove the AppData execution restriction or white list the .exe files there (e.g., chromedriver.exe, edgedriver.exe) (which I cannot do), the workaround--which I have now successfully accomplished--is to create a SeleniumBasic directory someplace other than under AppData (this might be in Program Files (x86), but one will need administrative priviledges to do that), copy the contents of the AppData\Local\SeleniumBasic directory to this new directory.

At this point, one can test that the new location permits .exe execution by the same test noted above demonstrating the execution restriction.

This is not the end of the effort, however. On installation, SeleniumBasic registers itself and its components in multiple ways in the registry. Using a tool such as NirSoft's RegScanner, once can find and export from the registry as a .reg file (the "original" file) all occurrences of c:\users\[username]\AppData\Local\SeleniumBasic, copy the original file to a new file (the "revised" file), edit the revised file to change all occurrences of the noted path to the new path to SeleniumBasic, and save that file. (Note that keeping a .reg file with the original entries is prudent in case the prior set-up needs to be restored.) Then import the revised .reg file and reboot.

Finally, in one's Office VBA projects using Selenium Basic, the Reference to the Selenium Type Library needs to be re-established.

That did it for me and now both the test .vbs scripts SeleniumBasis\Scrips and my VBA code previously attempting to make use of the Selenium Type Library work!

Hope this helps those who have been having this problem.

NDeLancie avatar Jul 14 '21 03:07 NDeLancie

I think I have solved the problem reported here (and elsewhere on the web) with the Run-time Error -2146233078 (801315a).

The problem occurs, I think, because SeleniumBasic forces its installation in the c:\users[username]\AppData\Local\SeleniumBasic directory (no way to change this on installation so far as I can see), and on many systems, there is a group security policy in effect that restricts execution of .exe and other executables in the user's AppData directory (as a security precaution against malicious executables being installed in AppData).

This can be demonstrated by double clicking one of the web drivers (e.g., chromedriver.exe, edgedriver.exe) in the AppData\Local\SeleniumBasic directory and seeing if it is blocked or a command window opens indicating its instantiation.

Unless a user can remove the AppData execution restriction or white list the .exe files there (e.g., chromedriver.exe, edgedriver.exe) (which I cannot do), the workaround--which I have now successfully accomplished--is to create a SeleniumBasic directory someplace other than under AppData (this might be in Program Files (x86), but one will need administrative priviledges to do that), copy the contents of the AppData\Local\SeleniumBasic directory to this new directory.

At this point, one can test that the new location permits .exe execution by the same test noted above demonstrating the execution restriction.

This is not the end of the effort, however. On installation, SeleniumBasic registers itself and its components in multiple ways in the registry. Using a tool such as NirSoft's RegScanner, once can find and export from the registry as a .reg file (the "original" file) all occurrences of c:\users[username]\AppData\Local\SeleniumBasic, copy the original file to a new file (the "revised" file), edit the revised file to change all occurrences of the noted path to the new path to SeleniumBasic, and save that file. (Note that keeping a .reg file with the original entries is prudent in case the prior set-up needs to be restored.) Then import the revised .reg file and reboot.

Finally, in one's Office VBA projects using Selenium Basic, the Reference to the Selenium Type Library needs to be re-established.

That did it for me and now both the test .vbs scripts SeleniumBasis\Scrips and my VBA code previously attempting to make use of the Selenium Type Library work!

Hope this helps those who have been having this problem.

No, it does not. IF I move my SeleniumBasic contents to Program Files (x86), it throws DLL error.

KabeerSajid avatar Dec 15 '21 19:12 KabeerSajid

i had the same problem, after installing Net Framework 3.5 it is working

murattinr1 avatar Sep 26 '22 18:09 murattinr1