PerditionC / VBAChromeDevProtocol

VBA (Excel) based wrapper for Chrome Developer Protocol (CDP) - sorta a VBA version of Puppeteer/Selenium
https://PerditionC.github.io/VBAChromeDevProtocol/
MIT License
60 stars 11 forks source link

'hInPipe = hStdOutRd' throws error 458 (!) #12

Closed 6DiegoDiego9 closed 2 years ago

6DiegoDiego9 commented 2 years ago

I'm trying this library for the first time after an old failed try and I now can't even get the simple cdp.launch "https://www.google.com/" (in test1a) to work: the instruction hInPipe = hStdOutRd of Functions.SpawnProcess throws error 458 -"Variable uses an Automation type not supported in Visual Basic"

An F8 on that instruction goes directly to the clsCDP.launch line Debug.Print "cldCDP.launch() - Error: " & Err.description that prints this: "cldCDP.launch() - Error: Variable uses an Automation type not supported in Visual Basic"

hInPipe is a Variant/LongLong (value=0) hStdOutRd is a LongLong (value=5536^)

I don't even know how it's possible for VBA to fail on such a plain simple value assignation.

6DiegoDiego9 commented 2 years ago

Also, just before the error occurs, Firefox browser opens. Why Firefox? I have Edge+Chrome+Firefox all installed.

PerditionC commented 2 years ago

What version of VBA are you using? E.g. Excel 64 bit on Windows 10, Access 32 bit on Windows 11, ... Are you using a project (Excel file/...) that you built from source (added the class and modules files yourself), Excel file from the dist/ folder with them included, or a [old] release version? Thank you.

PerditionC commented 2 years ago

The launching firefox is probably related, but it should only launch it if it thinks Chrome & Edge are in use [already running]. Try running changing it to use Chromium install of Any browser so it doesn't try firefox. Unfortunately firefox is not yet supported as its CDP use is not quite as developed as I had hoped. I am working on it though, Chrome treats the newpage as a Page where firefox does not.

6DiegoDiego9 commented 2 years ago

Last version of Excel 64bit (2208 (Build 15601.20148)). Last version (downloaded yesterday) of your examples.xlsm file in Dist folder.

"Try running changing it to use Chromium install of Any browser": how?

PerditionC commented 2 years ago

Sorry this was my fault. I had done some refactoring and had the optional byref parameters as Variant which caused the odd error message. I changed them to LongPtr which is the type of the values stored. Should be fixed by commit 8b728b3574a37022a019433444e5a5d5ff25f8c3. If you download updated dist/CBP Addin.xlam, it should work again. Thank you for reporting the issue. Please re-open if you are still having issues after updating or open a new issue.