"Class not registered" when running a (working) SeleniumBasic VBA macro from a VBScript and Task Scheduler
rufogil opened this issue · 5 comments
I have a VBA macro using SeleniumBasic that runs >perfectly< from a command button in Excel 2019. I need this macro running from the Windows 10's Task Scheduler and when calling the same macro from a VBScript within Task Scheduler it produces a run time error "Class not registered" at this line:
Set MyDriver = New Selenium.ChromeDriver
This is the script I'm using with the Task Scheduler:
Dim ObjExcelApp
Dim ObjWorkbook
Set ObjExcelApp = CreateObject("excel.application")
Set ObjWorkbook = ObjExcelApp.Workbooks.Open("C:\SeleniumBasic_Test\WorkbooWithMacro.xlsm")
ObjExcelApp.Run "TestSeleniumBasic"
ObjWorkbook.Close False
ObjExcelApp.Quit
Set ObjExcelApp = Nothing
Nothing fancy here, just calling the Public Sub TestSeleniumBasic().
I tested the macro with .EdgeDriver and got the same "Class not registered" error. Again, the macro runs without issues from Excel.
Hi rufo, looks like the problem could be related to the fact that you are controlling excel externally but i may be wrong. Try runing everything with admin privileges at first if that doesnt work try declaring the driver inside your module but outside the sub.
Dim MyDriver As New Selenium.Chromedriver
Public sub testseleniumbasic()
MyDriver.start
' Run your test here
End sub
I am having the exact same issue. I believe there was a .net update released from Microsoft which screwed something up.
The problem keeps popping up from the Task Scheduler.
Any help on this will be greatly appreciated.
I call the Excel addin from a bat file using task scheduler. SearchBN.txt tells the addin to run macro immediately rather than from GUI.
`D:
CD "D:\userdata\selenium\books"
TYPE NUL > "SearchBN.txt"
START /B /high /wait /min "" "C:\Program Files (x86)\Microsoft Office\Office14\EXCEL.EXE" "D:\userdata\selenium\books\SearchBN.xlam"
DEL SearchBN.txt`
Hi rufo, looks like the problem could be related to the fact that you are controlling excel externally but i may be wrong. Try runing everything with admin privileges at first if that doesnt work try declaring the driver inside your module but outside the sub.
Dim MyDriver As New Selenium.Chromedriver
Public sub testseleniumbasic()
MyDriver.start
' Run your test here
End sub
I did this test. Same "Class not registered" result. Thanks!.
I am having the exact same issue. I believe there was a .net update released from Microsoft which screwed something up. The problem keeps popping up from the Task Scheduler. Any help on this will be greatly appreciated.
Is it a VBA bug?. Classes ChromeDriver and EdgeDriver are registered. Yesterday I was preparing a new workbook with a tiny SeleniumBasic macro to reproduce the problem and show its code here and it ran without issues from the VBScript and the Task Scheduler!. As a test, I opened a totally new workbook and copied there the strictly necessary to run my original SeleniumBasic "buggy" macro, and for my surprise it fully ran. I didn't drag and drop the modules, instead, I created the modules manually from zero and I copied and pasted their code as text. Today I'm planning to uncheck the other libraries references I'm using to see the results... But at this point, I'm just randomly "shooting arrows"... Thanks!.
Any resolution so far on the issue above? I get the exact same error...