SeleniumBasic icon indicating copy to clipboard operation
SeleniumBasic copied to clipboard

Error in VM with multiple Users (8013150A - The source was not found, but some or all event logs could not be searched)

Open MatheusToledo opened this issue 4 years ago • 5 comments

Hi all,

I'm running a script using Selenium inside a VM, where multiple users can be connected at the same time.

If one user runs a script with selenium, it works fine, but if other users connected to the same VM tries to run it at the same time, they're get this error: Imagem Erro

If the user that is running the selenium ends it, then one of the other users is able to start it without any trouble (the one who opens first).

The Seleniumbasic was installed for each user separately, on its own profile but, for me, it seems that its using some shared file/resource... Is there anyway to work around this issue?

I didn't add any code example because it happens even using the script samples that comes with selenium basic, like StartChrome.vbs, StartEdge.vbs, etc.

I think it is worth mentioning that the error happens even with users running scripts that use different drivers

Thanks in advance!

MatheusToledo avatar Feb 13 '21 21:02 MatheusToledo

Hello Matheus,

I have the same issue!

Did you find something to fix it since last february ?

Best Regards Martial.

Martial57280 avatar Sep 16 '21 12:09 Martial57280

have the same issue in ts with multiple users once a users starts other users cannot run it. quit dose not seem to release all references. the only way i can use it if the other users close completely the application that used the driver, otherwise i cant free it up.

IsaacBreuer avatar Nov 14 '22 19:11 IsaacBreuer

这是来自QQ邮箱的假期自动回复邮件。 已经收到,等我看到了,立马回复。 

wolflash666 avatar Nov 14 '22 19:11 wolflash666

ok, i bit of progress, but not fixed.

the error we see is because of another error , but we don't get to see the actual error since it tried to write to event log but the source is not registered ,

so we need to add a registry Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\Application\SeleniumBasic

and EventMessageFile key with this value C:\Windows\Microsoft.NET\Framework64\v4.0.30319\EventLogMessages.dll

once this is done seleniumbasic can log.

so now i see the flowing error

System.TypeInitializationException Line 0 in The type initializer for 'Selenium.Core.SysWaiter' threw an exception.

looks like an error in this code https://github.com/florentbr/SeleniumBasic/blob/8a2cde358d2bc06e3014aca2c8d427bc61188a1b/Selenium/Core/SysWaiter.cs

IsaacBreuer avatar Nov 14 '22 22:11 IsaacBreuer

Hi I fixed for myself this issue by changing @"Global\InterruptKey" to @"Local\InterruptKey" in SysWaiter.cs, I than recompiled the DLL.

Global, will share the named event in the OS for all users, VS Local will only share it with current user session, so whan using Global\InterruptKey it created an EventWaitHandle name InterruptKey so whan the next user tried to create the same event there was a access violation. making sure its not global solved the issue, however I still wanted to add code to free up the eventwaithandle from resources once the driver is not in use. so I changed the quit function as well to clear it.

if you you have this issue and cant compile yourself, i can share my compiled DLL

(btw, as i compiled the DLL i also added a new property to allow you to set the driver executable, its just handy when using this for multiple users and each one can sometimes have a different browser version, so i have some logic that will download the right driver and name it with a version number , i keeps all versions so when browser with version i already have i will pass the proper drivers , if drivers is not yet in directory ill download it.)

IsaacBreuer avatar Nov 15 '22 01:11 IsaacBreuer